mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-04 22:00:34 +08:00
commit
fd2e3903cd
@ -0,0 +1,130 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (unigeorge)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13849-1.html)
|
||||
[#]: subject: (Learn Fortran by writing a "guess the number" game)
|
||||
[#]: via: (https://opensource.com/article/21/1/fortran)
|
||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||
|
||||
通过写“猜数字”游戏学习 Fortran
|
||||
======
|
||||
|
||||
> Fortran 是在打孔卡时代编写的语言,因此它的语法非常有限。但你仍然可以用它编写有用和有趣的程序。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/04/125311k6uwzpybabayyoag.jpg)
|
||||
|
||||
Fortran 77 是我学习的第一门编译型编程语言。一开始时,我自学了如何在 Apple II 上用 BASIC 编写程序,后来又学会在 DOS 上用 QBasic 编写程序。但是当我去大学攻读物理学时,我又学习了 [Fortran][2]。
|
||||
|
||||
Fortran 曾经在科学计算中很常见。曾几何时,所有计算机系统都有一个 Fortran 编译器。Fortran 曾经像今天的 Python 一样无处不在。因此,如果你是像我这样的物理学专业学生,在 1990 年代工作,那你肯定学习了 Fortran。
|
||||
|
||||
我一直认为 Fortran 与 BASIC 有点相似,所以每当我需要编写一个简短程序,来分析实验室数据或执行其他一些数值分析时,我都会很快想到 Fortran。我在空闲时用 Fortran 编写了一个“猜数字”游戏,其中计算机会在 1 到 100 之间选择一个数字,并让我猜这个数字。程序会一直循环,直到我猜对了为止。
|
||||
|
||||
“猜数字”程序练习了编程语言中的几个概念:如何为变量赋值、如何编写语句以及如何执行条件判断和循环。这是学习新编程语言时一个很好的的实践案例。
|
||||
|
||||
### Fortran 编程基础
|
||||
|
||||
虽然 Fortran 这些年来一直在更新,但我最熟悉的还是 Fortran 77,这是我多年前学习的实现版本。Fortran 是程序员还在打孔卡上编程的年代创建的,因此“经典” Fortran 仅限于处理可以放在打孔卡上的数据。这意味着你只能编写符合以下限制条件的经典 Fortran 程序(LCTT 译注:后来的 Fortran 95 等版本已经对这些限制做了很大的改进,如有兴趣**建议直接学习新版**):
|
||||
|
||||
* 每张卡只允许一行源代码。
|
||||
* 仅识别第 1-72 列(最后八列,73-80,保留给卡片分类器)。
|
||||
* 行号(“标签”)位于第 1-5 列。
|
||||
* 程序语句在第 7-72 列。
|
||||
* 要表示跨行,请在第 6 列中输入一个连续字符(通常是 `+`)。
|
||||
* 要创建注释行,请在第 1 列中输入 `C` 或 `*`。
|
||||
* 只有字符 `A` 到`Z`(大写字母)、`0` 到`9`(数字)和特殊字符 `= + - * / ( ) , . $ ' :` 和空格能够使用。
|
||||
|
||||
虽然有这些限制,你仍然可以编写非常有用和有趣的程序。
|
||||
|
||||
### 在 Fortran 中猜数字
|
||||
|
||||
通过编写“猜数字”游戏来探索 Fortran。这是我的实现代码:
|
||||
|
||||
```
|
||||
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
||||
C PROGRAM TO GUESS A NUMBER 1-100
|
||||
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
||||
PROGRAM GUESSNUM
|
||||
INTEGER SEED, NUMBER, GUESS
|
||||
|
||||
PRINT *, 'ENTER A RANDOM NUMBER SEED'
|
||||
READ *, SEED
|
||||
CALL SRAND(SEED)
|
||||
|
||||
NUMBER = INT( RAND(0) * 100 + 1 )
|
||||
|
||||
PRINT *, 'GUESS A NUMBER BETWEEN 1 AND 100'
|
||||
10 READ *, GUESS
|
||||
|
||||
IF (GUESS.LT.NUMBER) THEN
|
||||
PRINT *, 'TOO LOW'
|
||||
ELSE IF (GUESS.GT.NUMBER) THEN
|
||||
PRINT *, 'TOO HIGH'
|
||||
ENDIF
|
||||
|
||||
IF (GUESS.NE.NUMBER) GOTO 10
|
||||
|
||||
PRINT *, 'THATS RIGHT!'
|
||||
END
|
||||
```
|
||||
|
||||
如果你熟悉其他编程语言,你大概可以通过阅读源代码来弄清楚这个程序在做什么。前三行是注释块,表示程序的功能。第四行 `PROGRAM GUESSNUM` 将其标识为一个 <ruby><rb>程序</rb><rt>program</rt></ruby>,并由最后一行的 `END` 语句关闭。
|
||||
|
||||
定义变量后,程序会提示用户输入随机数种子。Fortran 程序无法从操作系统初始化随机数生成器,因此你必须始终使用“种子”值和 `SRAND` <ruby><rb>子程序</rb><rt>subroutine</rt></ruby> 启动随机数生成器。
|
||||
|
||||
Fortran 使用 `RAND(0)` 函数生成 0 到 0.999…… 之间的随机数。参数 `0` 告诉 `RAND` 函数生成一个随机数。将此随机数乘以 100 以生成 0 到 99.999…… 之间的数字,然后加 1 得到 1 到 100.999…… 之间的值。`INT` 函数将结果截断为整数;因此,变量 `NUMBER` 就是一个介于 1 到 100 之间的随机数。
|
||||
|
||||
程序会给出提示,然后进入一个循环。Fortran 不支持更现代的编程语言中可用的 `while` 或 `do-while` 循环(LCTT 译注:Fortran 95 等新版支持,也因此在一定程度上减少了 `GOTO` 的使用)。相反,你必须使用标签(行号)和 `GOTO` 语句来构建自己的循环。这就是 `READ` 语句有一个行号的原因:你可以在循环末尾使用 `GOTO` 跳转到此标签。
|
||||
|
||||
穿孔卡片没有 `<`(小于)和 `>`(大于)符号,因此 Fortran 采用了另一种语法来进行值比较。要测试一个值是否小于另一个值,请使用 `.LT.`(小于)。要测试一个值是否大于另一个值,请使用 `.GT.`(大于)。等于和不等于分别是 `.EQ.` 和 `.NE.`。
|
||||
|
||||
在每次循环中,程序都会验证用户的猜测值。如果用户的猜测值小于随机数,程序打印 `TOO LOW`,如果猜测大于随机数,程序打印 `TOO HIGH`。循环会一直持续,直到用户的猜测值等于目标随机数为止。
|
||||
|
||||
当循环退出时,程序打印 `THATS RIGHT!` 并立即结束运行。
|
||||
|
||||
```
|
||||
$ gfortran -Wall -o guess guess.f
|
||||
|
||||
$ ./guess
|
||||
ENTER A RANDOM NUMBER SEED
|
||||
93759
|
||||
GUESS A NUMBER BETWEEN 1 AND 100
|
||||
50
|
||||
TOO LOW
|
||||
80
|
||||
TOO HIGH
|
||||
60
|
||||
TOO LOW
|
||||
70
|
||||
TOO LOW
|
||||
75
|
||||
TOO HIGH
|
||||
73
|
||||
TOO LOW
|
||||
74
|
||||
THATS RIGHT!
|
||||
```
|
||||
|
||||
每次运行程序时,用户都需要输入不同的随机数种子。如果你总是输入相同的种子,程序给出的随机数也会一直不变。
|
||||
|
||||
### 在其他语言中尝试
|
||||
|
||||
在学习一门新的编程语言时,这个“猜数字”游戏是一个很好的入门程序,因为它以非常简单的方式练习了几个常见的编程概念。通过用不同的编程语言实现这个简单的游戏,你可以弄清一些核心概念以及比较每种语言的细节。
|
||||
|
||||
你有最喜欢的编程语言吗?如何用你最喜欢的语言来编写“猜数字”游戏?跟随本系列文章来查看你可能感兴趣的其他编程语言示例吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/1/fortran
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[unigeorge](https://github.com/unigeorge)
|
||||
校对:[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/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
|
||||
[2]: https://en.wikipedia.org/wiki/Fortran
|
@ -0,0 +1,186 @@
|
||||
[#]: subject: (Comparing Linux Mint and Fedora: Which One Should You Use?)
|
||||
[#]: via: (https://itsfoss.com/linux-mint-vs-fedora/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Linux Mint 和 Fedora:应该使用哪一个?
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/04/123523kzzm3x4yr2ppmfj9.jpg)
|
||||
|
||||
Linux Mint 是一个 [为初学者定制的流行的 Linux 发行版][1],同时为用户提供了与 Windows 类似的体验。事实上,它有 [一些地方比 Ubuntu 做的更好][2],这使它成为每一类用户的合适选择。
|
||||
|
||||
它是基于 Ubuntu 的,完全由社区所支持。
|
||||
|
||||
另一方面,Fedora 是一个尝鲜发行版,它专注于纳入令人兴奋的变化,最终使其成为红帽企业 Linux(RHEL)的一部分。
|
||||
|
||||
与 Linux Mint 不同,Fedora 并不完全专注于个人(或非开发者)使用。即使他们提供了一个工作站版本,其目标也是开发者和有经验的 Linux 用户。
|
||||
|
||||
### Fedora 或 Mint,应该根据什么选择?
|
||||
|
||||
虽然我们知道 Fedora 并不是完全面向 Linux 新手的,但许多用户喜欢使用 Fedora 作为他们的日常系统。因此,在这篇文章中,我们将阐明两者之间的一些区别,以帮助你选择一个在你的台式机上使用的操作系统。
|
||||
|
||||
#### 系统要求 & 硬件兼容性
|
||||
|
||||
![][3]
|
||||
|
||||
在选择任何 Linux 发行版之前,你都应该看一下它的系统要求,并检查硬件兼容性。
|
||||
|
||||
在这方面,Linux Mint 和 Fedora 都需要至少 2GB 的内存、20GB 的磁盘空间,以及 1024 x 768 分辨率的显示器来获得入门级的体验。
|
||||
|
||||
是的,官方文件可能提到 1GB 内存就可以起步,但要看实际使用情况。除非你有一台复古的电脑,想为一个特定的目的恢复它,否则它就不在考虑范围之内。
|
||||
|
||||
![Linux Mint 资源使用情况][4]
|
||||
|
||||
在技术上,两者都支持现代的和陈旧的硬件,你只有在安装时才会知道软件/驱动是否支持它。除非你有一个特殊的外围设备或具有特殊功能的硬件组件,否则硬件支持可能不是什么大问题。
|
||||
|
||||
Linux Mint 19 系列仍然提供了对 32 位系统的支持,你可以使用它到 2023 年 4 月。而 Fedora 已经不支持 32 位系统了。
|
||||
|
||||
#### 软件更新周期
|
||||
|
||||
![Linux Mint 更新管理器][5]
|
||||
|
||||
Linux Mint 专注于长期发布版(LTS),支持时间为五年。它的维护方式与 Ubuntu 相同。但没有像 Ubuntu 那样提供付费的扩展支持。
|
||||
|
||||
Fedora 不提供 LTS 版本,而是每 6 个月推送一次新的更新,每个版本都会得到 13 个月的软件支持。如果你愿意,你可以跳过一个版本。
|
||||
|
||||
如果你只是想安装一个可以使用多年的 Linux 发行版,而不在乎是不是最新的技术/功能,那么 Linux Mint 是个不错的选择。
|
||||
|
||||
但是,如果你想要最新的和最伟大的 Linux 技术(在一些罕见的情况下,这也可能破坏你的计算体验),并接受适应 Fedora 推动的重大变化,Fedora 可以是一个选择。
|
||||
|
||||
#### 桌面环境的选择
|
||||
|
||||
![Linux Mint Cinnamon 版][6]
|
||||
|
||||
Linux Mint 提供三种不同的 [桌面环境][7]:MATE、Cinnamon 和 Xfce。它们有相同的更新周期,并从发布之日起支持 5 年。
|
||||
|
||||
尽管 Fedora 不提供 LTS 版本,但你可以通过 Fedora spins 的形式选择各种桌面。你可以得到 KDE、LXQt、MATE、Cinnamon、LXDE,以及一个内置 i3 平铺窗口管理器的版本。
|
||||
|
||||
![Fedora 34 with GNOME 40][8]
|
||||
|
||||
所以,如果你想有更多的选择,Fedora 可以是一个相当令人激动的选择。
|
||||
|
||||
#### 软件可用性
|
||||
|
||||
![Linux Mint 的软件中心和软件包管理器][9]
|
||||
|
||||
Linux Mint(或 Ubuntu)的默认软件库提供了大量可以安装的软件,而 Fedora 的默认软件库只坚持提供开源软件。
|
||||
|
||||
不仅仅限于此,Linux Mint 还配备了 [Synaptic 软件包管理器][10],这是一个令人印象深刻的安装软件的轻量级工具。
|
||||
|
||||
尽管你可以 [在 Fedora 中启用第三方软件库][11],但这又是一个额外的步骤。而且,RPM Fusion 存储库可能没有 Ubuntu 的 universe 存储库那么庞大。
|
||||
|
||||
![Fedora 34 软件中心][12]
|
||||
|
||||
所以,对于 Linux Mint 来说,总的来说,你可以得到更多可安装的软件包和各种安装软件的方法,开箱即用。
|
||||
|
||||
#### 使用和安装的便利性
|
||||
|
||||
对于一个 Linux 的新嫩用户来说,Ubuntu 或任何基于 Ubuntu 的发行版通常都是一个很好的开端。
|
||||
|
||||
从 [Ubuntu 的安装体验][13],到 [安装软件][14] 的简便性,同时还可以选择 LTS 版本,这让初学者觉得很方便。
|
||||
|
||||
而且,借助 Ubiquity 安装程序,Linux Mint 自然也有与 Ubuntu 相同的好处,因此,它的学习曲线最小,易于安装,易于使用。
|
||||
|
||||
虽然从表面上看 Fedora 并不复杂,但安装选项、软件包管理器以及默认存储库中缺乏的软件可能是一个耗时的因素。
|
||||
|
||||
如果你没有尝试过,我建议你试试我们的 [VirtualBox 版的 Fedora 安装指南][15]。这是一个测试安装体验的好方法,然后再在你的任何生产系统上进行尝试。
|
||||
|
||||
#### 开箱即用的体验
|
||||
|
||||
最省事的体验通常是令人愉快的选择。嗯,对大多数人来说。
|
||||
|
||||
现在,你需要明白,根据硬件配置的不同,每个用户最终可能会有不同的“开箱即用”体验。
|
||||
|
||||
但是,作为参考,让我给你举个 Fedora 和 Linux Mint 的例子。
|
||||
|
||||
考虑到我的电脑上使用的是 NVIDIA GPU,我需要安装专有的驱动程序以获得最佳性能。
|
||||
|
||||
![][16]
|
||||
|
||||
而且,当我启动 Linux Mint 时,使用“驱动程序管理器”应用程序,安装驱动程序相当容易。
|
||||
|
||||
但是,对于 Fedora,即使我按照我们的 [在 Fedora 中安装 Nvidia 驱动程序][17] 的指南,我在重启时还是出现了一个错误。
|
||||
|
||||
![在 Fedora 中安装 NVIDIA 驱动程序][18]
|
||||
|
||||
不仅如此,由于某些原因,我的有线网络似乎没有被激活,因此,我没有互联网连接。
|
||||
|
||||
是的,当你遇到问题时,你总是可以尝试着去排除故障,但是对于 Linux Mint,我不需要这么做。所以,根据我的经验,我会推荐 Linux Mint,它有更好的开箱体验。
|
||||
|
||||
#### 文档
|
||||
|
||||
如果你依赖于文档资源并想在这个过程中挑战自己,获得不错的学习经验,我推荐你去看看 [Fedora 的文档][19]。
|
||||
|
||||
你会发现最近和最新的 Fedora 版本的最新信息,这是件好事。
|
||||
|
||||
另一方面,[Linux Mint 的文档][20] 没有定期更新,但在你想深入挖掘时很有用。
|
||||
|
||||
#### 社区支持
|
||||
|
||||
你会得到一个良好的社区支持。[Linux Mint 的论坛][21] 是一个很基础的平台,容易使用并能解决问题。
|
||||
|
||||
[Fedora 的论坛][22] 是由 Discourse 驱动的,它是最 [流行的现代开源论坛软件][23] 之一。
|
||||
|
||||
#### 企业与社区的角度
|
||||
|
||||
Fedora 得到了最大的开源公司 [红帽][24] 的支持 —— 因此你可以得到良好的持续创新和长期的支持。
|
||||
|
||||
然而,正因为 Fedora 并不是为日常电脑用户而建立的,每一个版本的选择都可能完全影响你的用户体验。
|
||||
|
||||
另一方面,Linux Mint 完全由一个充满激情的 Linux 社区所支持,专注于使 Linux 在日常使用中更加容易和可靠。当然,它依赖于 Ubuntu 作为基础,但如果社区不喜欢上游的东西,Linux Mint 也会做出大胆的改变。
|
||||
|
||||
例如,Linux Mint 与 Ubuntu 官方发行版不同,默认情况下禁用了 snap。所以,如果你想使用它们,你就必须 [在 Linux Mint 中启用 snap][25]。
|
||||
|
||||
### 总结
|
||||
|
||||
如果你想为你的家用电脑选择一个没有问题的、易于使用的操作系统,我的建议是 Linux Mint。但是,如果你想体验最新的、最伟大的 Linux 操作系统,同时在你的 Linux 学习经历中进行一次小小的冒险,Fedora 可以是一个不错的选择。
|
||||
|
||||
虽然每个操作系统都需要某种形式的故障排除,没有什么能保证你的硬件完全不出问题,但我认为 Linux Mint 对大多数用户来说可能没有问题。
|
||||
|
||||
在任何情况下,你可以重新审视上面提到的比较点,看看什么对你的电脑最重要。
|
||||
|
||||
你怎么看?你会选择 Fedora 而不是 Mint 吗?还有,为什么?请在下面的评论中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/linux-mint-vs-fedora/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/best-linux-beginners/
|
||||
[2]: https://itsfoss.com/linux-mint-vs-ubuntu/
|
||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-34-about.png?resize=1020%2C709&ssl=1
|
||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-resources.png?resize=800%2C293&ssl=1
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-update-manager.png?resize=819%2C612&ssl=1
|
||||
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-cinnamon-desktop.png?resize=800%2C450&ssl=1
|
||||
[7]: https://itsfoss.com/best-linux-desktop-environments/
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-34-desktop.png?resize=800%2C478&ssl=1
|
||||
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-software-sources.png?resize=800%2C385&ssl=1
|
||||
[10]: https://itsfoss.com/synaptic-package-manager/
|
||||
[11]: https://itsfoss.com/fedora-third-party-repos/
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-34-software.png?resize=1055%2C691&ssl=1
|
||||
[13]: https://itsfoss.com/install-ubuntu/
|
||||
[14]: https://itsfoss.com/remove-install-software-ubuntu/
|
||||
[15]: https://itsfoss.com/install-fedora-in-virtualbox/
|
||||
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/linux-mint-driver-manager.jpg?resize=800%2C548&ssl=1
|
||||
[17]: https://itsfoss.com/install-nvidia-drivers-fedora/
|
||||
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-nvidia-driver-installation.png?resize=706%2C516&ssl=1
|
||||
[19]: https://docs.fedoraproject.org/en-US/docs/
|
||||
[20]: https://linuxmint.com/documentation.php
|
||||
[21]: https://forums.linuxmint.com
|
||||
[22]: https://ask.fedoraproject.org
|
||||
[23]: https://itsfoss.com/open-source-forum-software/
|
||||
[24]: https://www.redhat.com/en
|
||||
[25]: https://itsfoss.com/enable-snap-support-linux-mint/
|
@ -0,0 +1,180 @@
|
||||
[#]: subject: (Top 5 Chrome-like Browsers That Are Better Than Google Chrome in 2021)
|
||||
[#]: via: (https://news.itsfoss.com/chrome-like-browsers-2021/)
|
||||
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13858-1.html)
|
||||
|
||||
Linux 上 5 个基于 Chromium 的浏览器
|
||||
======
|
||||
|
||||
> 谷歌浏览器可能不是 Linux 用户的最佳浏览器。在这里,我们探讨了 Linux 平台的其他潜在选择。
|
||||
|
||||
![](https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/06/chrome-alternatives-2021.png?w=1200&ssl=1)
|
||||
|
||||
想摆脱谷歌?想为你的 Linux 系统寻找可能比谷歌浏览器(和类似的)更好的浏览器?
|
||||
|
||||
幸运的是,有多个谷歌浏览器的替代品,你可以试试。
|
||||
|
||||
它们中的每一个都带来了一些有趣的东西,同时也保持了 Chrome 所特有的奇妙兼容性。请继续阅读,了解这些浏览器的更多信息。
|
||||
|
||||
### 比谷歌浏览器更好的选择
|
||||
|
||||
> 注:虽然 [自由和开源软件在取代科技巨头方面扮演着关键角色][1],但除了谷歌浏览器之外,Linux 上的任何选择都是一个好的开始。因此,你也会发现一些非 FOSS 的选择。
|
||||
|
||||
在我看来,Chrome 的最佳替代品是基于 Chromium 的浏览器,这意味着它们与 Chrome 共享相同的基因。这样做的好处是,它们已经拥有与 Chrome 相同的功能,同时有更多时间来增加自己的功能。
|
||||
|
||||
另外,如果你愿意,你可以了解一下不基于 Chromium 的 [Chrome 开源替代品][2]。
|
||||
|
||||
无论如何,即使谷歌浏览器的替代品对你来说并不优越,也值得尝试远离科技巨头。
|
||||
|
||||
我们收集了一些在各方面与 Chrome 相当或更好的浏览器。闲话少说,以下是我挑选的五款比 Chrome 本身更好的类似 Chrome 的浏览器:
|
||||
|
||||
* UnGoogled Chromium
|
||||
* Brave
|
||||
* Edge
|
||||
* Vivaldi
|
||||
* Opera
|
||||
|
||||
这份名单没有排名顺序。
|
||||
|
||||
### 1、UnGoogled Chromium
|
||||
|
||||
![][13]
|
||||
|
||||
特点:
|
||||
|
||||
* 移除针对谷歌域名的功能
|
||||
* 在运行时阻止对 Google 的内部请求
|
||||
* 从源代码中剥离谷歌的二进制文件
|
||||
* 许多新的命令行开关和 `chrome://flags` 条目
|
||||
* 强制所有弹出式窗口为标签
|
||||
|
||||
对于那些隐私爱好者来说,[UnGoogled Chromium][4] 浏览器将是一个天赐良机。虽然它可能看起来与 Chrome 相同,但它有许多隐私方面的调整。
|
||||
|
||||
顾名思义,对于 Chrome 浏览器的用户来说,最大的倒退将是没有谷歌的服务集成。但这也意味着不再有对谷歌的内部请求、谷歌网址跟踪等等。
|
||||
|
||||
它没有吹嘘任何非凡的东西来保护你的隐私,但它应该比谷歌浏览器更好。
|
||||
|
||||
你也可以选择通过 `chrome://flags` 设置来探索和切换隐私设置。
|
||||
|
||||
总而言之,UnGoogled Chromium 提供了一种熟悉的浏览体验,同时还加入了一套隐私功能。它是可靠的,而且还与 Chrome 扩展程序庞大的生态系统兼容。
|
||||
|
||||
### 2、Brave
|
||||
|
||||
![][14]
|
||||
|
||||
特点:
|
||||
|
||||
* 内置广告拦截器
|
||||
* 更快的页面加载时间
|
||||
* Brave 奖励计划
|
||||
* 能够在设备之间进行同步
|
||||
* 支持 Chrome Web 商店
|
||||
|
||||
当 [Brave][6] 在 2016 年首次登上舞台时,世界各地的人们都震惊于它的隐私和性能特点。在发布时,这包括了一个内置的广告屏蔽器和一个新的用户界面。
|
||||
|
||||
从那时起,该浏览器有了更多的功能,包括奖励计划和 [Tor][5] 整合。这使得它成为增长最快的浏览器之一。
|
||||
|
||||
### 3、Edge
|
||||
|
||||
![][15]
|
||||
|
||||
特点:
|
||||
|
||||
* 支持 Chrome Web 商店
|
||||
* 儿童浏览模式(额外的保护和更简单的用户界面)
|
||||
* 良好的 PDF 编辑工具
|
||||
* 内置优惠券搜索器
|
||||
* 阅读模式
|
||||
* 内置密码生成器
|
||||
|
||||
当微软 [Edge][7] 在 2015 年首次与 Windows 10 一起发布时,它因缓慢和有缺陷而被广泛批评。然而,在 2020 年初,它使用 Chromium Web 引擎完全重新制作了。
|
||||
|
||||
这也是 Chrome 浏览器所基于的引擎,这提供了现代和快速的浏览体验。这种转变的一个好处是 Web 浏览器能够在许多不同的平台上运行,从 Windows 7 和 macOS 到 Ubuntu 和其他基于 Linux 的发行版。
|
||||
|
||||
我知道,如果你因为某些原因讨厌微软,这可能不会吸引你 —— 但 Linux 版的微软 Edge 是谷歌 Chrome 浏览器的一个重要替代品。
|
||||
|
||||
### 4、Vivaldi
|
||||
|
||||
![][16]
|
||||
|
||||
特点:
|
||||
|
||||
* 内置翻译器
|
||||
* Vivaldi Email(Beta)
|
||||
* Feed 阅读器(Beta)
|
||||
* Vivaldi 日历(Beta)
|
||||
* 可高度定制的用户界面
|
||||
* 内置广告拦截器
|
||||
* 支持 Chrome Web 商店
|
||||
* 标签分组
|
||||
* 分屏标签
|
||||
|
||||
[Vivaldi][11] 于 2016 年首次发布,它在浏览器大战中迅速崛起。它最初是为对 [Presto][8] [布局引擎][9] 过渡不满的 Opera 用户设计的,它已经成功地重新实现了 Opera 过渡到 Chromium 期间失去的许多功能。
|
||||
|
||||
令人惊讶的是,它在基于 Chromium 的情况下还能做到这一点(正是 Opera 放弃这些功能的原因)。
|
||||
|
||||
最新的 [Vivaldi 4.0 版本][10] 也为高级用户提供了一些功能。
|
||||
|
||||
虽然它不是 100% 的自由软件,但其 93% 的源代码是可用的,只有用户界面是专有的。考虑到 Vivaldi 的开发团队积极关注着 Linux 用户的改进,Vivaldi 提供了大量的功能,这可能是一个值得权衡的结果。
|
||||
|
||||
### 5、Opera
|
||||
|
||||
![][17]
|
||||
|
||||
特点:
|
||||
|
||||
* 内置虚拟专用网络
|
||||
* 轻松访问社交媒体
|
||||
* 内置加密货币钱包
|
||||
* 欺诈和恶意软件保护
|
||||
* 高度可见的网站安全徽章
|
||||
|
||||
虽然 [Opera][12] 从未成为 Web 浏览器之王,但它一直存在于关于使用何种浏览器的争论中。它最初是基于其内部的 Presto 布局引擎的,在 2013 年切换到 Chromium。
|
||||
|
||||
不幸的是,这一转换意味着 Opera 团队被迫放弃了其最知名的一些功能,为 Vivaldi 和 Firefox 等替代品填补 Opera 留下的空间铺平道路。
|
||||
|
||||
这并不是说 Opera 缺乏功能,它包含了许多功能。
|
||||
|
||||
### 总结
|
||||
|
||||
在这里,我们列出了为 Linux 桌面平台上用户量身定做的浏览器。
|
||||
|
||||
无论你是想要更多的功能、更好的用户界面,还是想要帮助你摆脱谷歌的束缚,都有一个选择适合你。
|
||||
|
||||
由于所有这些浏览器都是基于 Chromium 的,它们都能像 Chrome 一样提供良好的兼容性和用户体验。因此,请切换到这些类似 Chrome 的浏览器中,享受它们各自赋予的自由吧。
|
||||
|
||||
2021 年,你最喜欢的 Linux 上谷歌浏览器的替代品是什么?请在下面的评论中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/chrome-like-browsers-2021/
|
||||
|
||||
作者:[Jacob Crume][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://news.itsfoss.com/author/jacob/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://news.itsfoss.com/save-privacy-with-foss/
|
||||
[2]: https://itsfoss.com/open-source-browsers-linux/
|
||||
[4]: https://github.com/Eloston/ungoogled-chromium
|
||||
[5]: https://itsfoss.com/tor-guide/
|
||||
[6]: https://brave.com
|
||||
[7]: https://www.microsoftedgeinsider.com/en-us/download
|
||||
[8]: https://en.wikipedia.org/wiki/Presto_(browser_engine)
|
||||
[9]: https://en.wikipedia.org/wiki/Browser_engine
|
||||
[10]: https://news.itsfoss.com/vivaldi-4-0-release/
|
||||
[11]: https://vivaldi.com
|
||||
[12]: https://www.opera.com
|
||||
[13]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/05/ungoogled-chromium-screenshot.png?w=1366&ssl=1
|
||||
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/06/brave-homepage.png?w=1366&ssl=1
|
||||
[15]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/06/edge-homepage.png?w=1366&ssl=1
|
||||
[16]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/06/vivaldi-4.0-homepage.png?w=1366&ssl=1
|
||||
[17]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/06/opera-homepage.png?w=1366&ssl=1
|
@ -0,0 +1,263 @@
|
||||
[#]: subject: (Creating a PKGBUILD to Make Packages for Arch Linux)
|
||||
[#]: via: (https://itsfoss.com/create-pkgbuild/)
|
||||
[#]: author: (Hunter Wittenborn https://itsfoss.com/author/hunter/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13843-1.html)
|
||||
|
||||
Arch Linux 软件包制作入门
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/02/130702ybexb5tsvkx1xbs1.jpg)
|
||||
|
||||
`PKGBUILD` 文件是为 Arch Linux 及其衍生版(如 Manjaro)构建和创建软件包的方式。
|
||||
|
||||
如果你曾经使用过 [AUR][1](即 Arch Linux 的用户维护的 `PKGBUILD` 存储库),你甚至可能也遇到过它们。
|
||||
|
||||
但是,到底是如何从 `PKGBUILD` 到可安装软件包的呢?这两者之间到底发生了什么,如何把自己的软件制作成软件包呢?你将在这篇文章中了解这些。
|
||||
|
||||
### PKGBUILD 基础知识
|
||||
|
||||
对于那些熟悉 Bash 或其他 shell 的人来说,你可能知道,`PKGBUILD` 就是一个带有一些变量的 shell 脚本。
|
||||
|
||||
`PKGBUILD` 文件由变量和函数组成,所有这些都是用来定义软件包本身,以及如何构建它。
|
||||
|
||||
为了从 `PKGBUILD` 中创建一个软件包,需要使用 `makepkg` 命令行工具。在获得 `PKGBUILD` 文件后,你只需在包含 `PKGBUILD` 的目录中运行 `makepkg',就可以得到一个可安装的软件包了。
|
||||
|
||||
![][2]
|
||||
|
||||
在本教程中,你将会看到我刚刚制作的软件包,它在运行时打印出 “Hello World!”。
|
||||
|
||||
![][3]
|
||||
|
||||
### 准备
|
||||
|
||||
为了继续学习本教程,你需要创建几个文件。
|
||||
|
||||
首先,你需要创建一个名为 `PKGBUILD` 的文件,它将作为构建你的软件包的“配方”。
|
||||
|
||||
你需要做的另一个文件是一个叫 `hello-world.sh` 的文件。我稍后会解释它的用途。
|
||||
|
||||
你也可以用一个命令来创建这两个文件:
|
||||
|
||||
```
|
||||
touch PKGBUILD hello-world.sh
|
||||
```
|
||||
|
||||
你可以用 `ls` 命令检查这些文件是否被创建。
|
||||
|
||||
![][4]
|
||||
|
||||
然后你就可以开始了!
|
||||
|
||||
### 设置你的 PKGBUILD 文件
|
||||
|
||||
我不会让你复制粘贴整个文件,而是和你一起键入每一行,这样你就能更好地理解每一行的目的。如果你不喜欢这种学习方式,我强烈推荐 [Arch 维基][5] 中为 Arch Linux 创建软件包的文章。
|
||||
|
||||
这篇文章也没有介绍 `PKGBUILD` 中可以设置的每一个选项,只是介绍了一些常用的选项,以便你能尽快上手。
|
||||
|
||||
说完了这些,打开你的文本编辑器,让我们直接进入正题吧。
|
||||
|
||||
#### pkgname
|
||||
|
||||
首先是 `pkgname` 变量。这是安装时定义软件包名称的东西,也是 [Arch Linux 的软件包管理器 pacman][6] 跟踪软件包的方式。
|
||||
|
||||
这个变量(以及其他一些变量)的格式是 `variable=value`,变量名在左边,变量的值在右边,用等号隔开。
|
||||
|
||||
要设置包的名称,请在 `PKGBUILD` 中输入以下内容:
|
||||
|
||||
```
|
||||
pkgname="hello-world"
|
||||
```
|
||||
|
||||
* 要设置一个不同的软件包名称,用你的软件包的名称替换 `hello-world`。
|
||||
* 这并不设置用于运行程序的命令,这将在下面的 `package()` 部分中处理。
|
||||
|
||||
#### pkgver
|
||||
|
||||
正如变量名称本身所述,它设置了你的软件包的版本(即 `1.0.0`)。这在用户更新他们的系统时很有用,因为设置更高的版本会提示用户升级。
|
||||
|
||||
要设置版本号,请在 `PKGBUILD` 中输入以下内容(在前一行之后):
|
||||
|
||||
```
|
||||
pkgver="1.0.0"
|
||||
```
|
||||
|
||||
#### pkgrel
|
||||
|
||||
这与 `pkgver` 变量有关,通常不需要知道。不过和 `pkgver` 变量一样,如果它被换到一个更高的数字,就将通知用户进行升级。
|
||||
|
||||
它适用于任何需要保持 `pkgver` 不变的情况下,例如 `PKGBUILD` 本身发生了变化。如果你为一个你使用的程序创建了一个 `PKGBUILD`(并希望保持软件包的版本相同),而你需要修复 `PKGBUILD` 本身的一个错误,这将是非常有用的。
|
||||
|
||||
要设置这个变量,请在 `PKGBUILD` 中输入以下内容:
|
||||
|
||||
```
|
||||
pkgver="1"
|
||||
```
|
||||
|
||||
这个变量应该 **总是** 从 `1` 开始,然后一次一次地向上移动。当 `pkgver` 本身向上移动时,这个变量可以(也应该)重置为 `1`,因为 `pkgver` 本身会通知用户升级。
|
||||
|
||||
#### pkgdesc
|
||||
|
||||
这将设置软件包的描述,用于帮助更好地识别该软件包。
|
||||
|
||||
要设置它,只需将描述放在引号内:
|
||||
|
||||
```
|
||||
pkgdesc="Hello world in your terminal!"
|
||||
```
|
||||
|
||||
#### arch
|
||||
|
||||
这个变量设置软件包所兼容的 [硬件架构][7]。如果你不明白什么是架构,那也没关系,因为在大多数情况下,这个变量几乎是无用的。
|
||||
|
||||
无论如何,`makepkg` 仍然需要设置它,这样它就知道这个软件包与我们的系统是兼容的。
|
||||
|
||||
这个变量支持设置多个值,所以 `makepkg` 需要一个不同的语法,如下所示。
|
||||
|
||||
要设置它,请在 `PKGBUILD` 中输入以下内容:
|
||||
|
||||
```
|
||||
arch=("x86_64")
|
||||
```
|
||||
|
||||
如果你要设置多个值,需要用空格和引号分隔每个值,像这样。`arch=(“x86_x64" "arm")`。
|
||||
|
||||
#### depends
|
||||
|
||||
这列出了提供了我们的软件包所需功能的所有软件包。与 `arch` 一样,它也可以包含多个值,因此必须使用括号语法。
|
||||
|
||||
由于我们的软件包没有任何依赖关系,所以我们不需要在 `PKGBUILD` 中输入这个字段。然而,如果我们的软件包有依赖关系,我们就会使用与 `arch` 相同的语法。
|
||||
|
||||
#### optdepends
|
||||
|
||||
这里列出了那些并不是提供所需功能而是额外功能的软件包。
|
||||
|
||||
这与 `depends` 的语法相同。
|
||||
|
||||
#### conflicts
|
||||
|
||||
这告诉 `pacman` 哪些软件包会导致我们的软件包出现问题,或者以我们不希望的方式行事。
|
||||
|
||||
这里列出的任何软件包都会在我们的软件包被安装之前被卸载。
|
||||
|
||||
这与 `depends` 的语法相同。
|
||||
|
||||
#### license
|
||||
|
||||
这定义了你的程序所采用的 [软件许可证][8]。如果你需要帮助你选择一个许可证,[Arch 维基][9] 提供了一些信息。如果你不知道该怎么设置,将其设置为 `custom` 也可以。
|
||||
|
||||
这与 `arch` 和 `depends` 的语法相同:
|
||||
|
||||
```
|
||||
license=("custom")
|
||||
```
|
||||
|
||||
#### source
|
||||
|
||||
这就是 `makepkg` 如何知道要用什么文件来构建我们的软件包。它可以包含各种不同类型的源,包括本地文件和 URL。
|
||||
|
||||
在添加本地文件时,要输入相对于 `PKGBUILD` 文件的文件路径,比如以下目录布局:
|
||||
|
||||
```
|
||||
PKGBUILD
|
||||
file.txt
|
||||
src/file.sh
|
||||
```
|
||||
|
||||
如果你想在我们的 `PKGBUILD` 中包括 `file.sh`,你需要输入 `src/file.sh` 作为其名称。
|
||||
|
||||
当输入 URL 时,你只需输入完整的 URL,即 `https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png`。
|
||||
|
||||
你的这个软件包只需要 `hello-world.sh` 文件,由于它和 `PKGBUILD` 在同一个目录中,你只需输入它的名字作为 `source` 的值。
|
||||
|
||||
这个变量也使用与 `arch` 和 `depends` 相同的语法:
|
||||
|
||||
```
|
||||
source=("hello-world.sh")
|
||||
```
|
||||
|
||||
#### sha512sums
|
||||
|
||||
这是用来验证 `source` 中的文件没有被修改或下载错误。如何获得这个值的信息可以在 [Arch 维基关于 PKGBUILD 的文章][10] 中找到。
|
||||
|
||||
如果你宁愿不设置这个(或者你只是不需要,例如对于本地文件),你可以为 `source` 变量中的每个文件输入 `SKIP`:
|
||||
|
||||
```
|
||||
sha512sums=("SKIP")
|
||||
```
|
||||
|
||||
#### package()
|
||||
|
||||
这是最后一个,也是实际制作我们的包的最重要的部分。在处理这个问题时,知道两个变量很重要。
|
||||
|
||||
* `${srcdir}`:这是 `makepkg` 放置 `source` 变量中文件的地方。在这个目录中,你可以与这些文件进行交互,并对文件进行任何其他需要的修改。
|
||||
* `${pkgdir}`:这是我们放置将被安装在系统中的文件的地方。
|
||||
`${pkgdir}` 的文件夹结构是按照实际系统中的情况设置的(例如,使用 `pacman` 安装时,`${pkgdir}/usr/bin/hello-world` 会创建文件 `/usr/bin/hello-world`)。
|
||||
|
||||
`package()` 包含一个用于创建软件包的命令列表。
|
||||
|
||||
因此,如果(假设)你需要有个在 `/usr/share/motto.txt` 写着 “Linux is superior to Windows ”的文件,你会运行这样的东西:
|
||||
|
||||
```
|
||||
package() {
|
||||
mkdir -p "${pkgdir}/usr/share"
|
||||
echo "Linux is superior to Windows" | tee "${pkgdir}/usr/share/motto.txt"
|
||||
}
|
||||
```
|
||||
|
||||
关于上述命令的一些说明:
|
||||
|
||||
* `${pkgdir}` 里面最初是 **不包含** 目录的。如果你跳过了 [mkdir 命令][11],`tee` 会输出一个错误,说这个目录不存在。
|
||||
* 在指定目录时,**总是** 在它们前面加上 `${pkgdir}` 或 `${srcdir}` 变量。如果输入 `/usr/share/motto.txt`,就会按照字面意义指向你当前运行的系统中的 `/usr/share/motto.txt`。
|
||||
|
||||
对于你的 `PKGBUILD`,你将把 `hello-world.sh` 文件放在目标系统的 `/usr/bin/hello-world` 中。你还将使该文件在运行时说 “Hello to you!”。
|
||||
|
||||
要做到这一点,请在 `PKGBUILD` 中输入以下内容:
|
||||
|
||||
```
|
||||
package() {
|
||||
echo 'Hello to you!' > "${srcdir}/hello-world.sh"
|
||||
mkdir -p "${pkgdir}/usr/bin"
|
||||
cp "${srcdir}/hello-world.sh" "${pkgdir}/usr/bin/hello-world"
|
||||
chmod +x "${pkgdir}/usr/bin/hello-world"
|
||||
}
|
||||
```
|
||||
|
||||
然后就完成了!用 `makepkg -si` 构建和安装软件包,然后在终端运行 `hello-world`,查看其输出。
|
||||
|
||||
![][12]
|
||||
|
||||
### 总结
|
||||
|
||||
就这样,你已经制作了你的第一个 `PKGBUILD`!你走在了为自己甚至是为 AUR 制作实际的软件包的路上。
|
||||
|
||||
有什么问题,或者有什么地方不对吗?请随时在下面的评论区发表。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/create-pkgbuild/
|
||||
|
||||
作者:[Hunter Wittenborn][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/hunter/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/aur-arch-linux/
|
||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/image.png?resize=748%2C689&ssl=1
|
||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/image-2.png?resize=682%2C260&ssl=1
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/05/image-3.png?resize=682%2C265&ssl=1
|
||||
[5]: https://wiki.archlinux.org/title/Creating_packages
|
||||
[6]: https://itsfoss.com/pacman-command/
|
||||
[7]: https://www.quora.com/What-is-CPU-architecture
|
||||
[8]: https://en.wikipedia.org/wiki/Software_license
|
||||
[9]: https://wiki.archlinux.org/title/PKGBUILD#license
|
||||
[10]: https://wiki.archlinux.org/title/PKGBUILD#Integrity
|
||||
[11]: https://linuxhandbook.com/mkdir-command/
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/image-1.png?resize=561%2C281&ssl=1
|
@ -2,31 +2,29 @@
|
||||
[#]: via: (https://fedoramagazine.org/run-github-actions-on-fedora-coreos/)
|
||||
[#]: author: (Clément Verna https://fedoramagazine.org/author/cverna/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13846-1.html)
|
||||
|
||||
Run GitHub Actions on Fedora CoreOS
|
||||
在 Fedora CoreOS 上运行 GitHub Actions
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
[United Artists][2], Public domain, via Wikimedia Commons
|
||||
[GitHub Actions][3] 是一项为快速建立持续集成和交付(CI/CD)工作流程而提供的服务。这些工作流程在被称为“<ruby>运行器<rt>runner</rt></ruby>”的主机上运行。GitHub 提供的 [托管运行器][4] 的操作系统的选择是有限的(Windows Server、Ubuntu、MacOS)。
|
||||
|
||||
[GitHub Actions][3] is a service provided to quickly setup continuous integration and delivery (CI/CD) workflows . These workflows run on hosts called _runners_. GitHub provides [hosted runners][4] with a limited set of operating system choice (Windows Server, Ubuntu, MacOS).
|
||||
另一个选择是使用 [自托管][5] 的运行器,这让仓库管理员对运行器有更多控制。自托管的运行程序是专门为某个存储库或组织服务的。下面的文章介绍了使用 Fedora CoreOS 配置自托管运行程序的步骤。
|
||||
|
||||
Another option is to use [self-hosted][5] runners which gives the repository administrator more control on the runners. Self-hosted runners are dedicated to a repository or organization. The following article goes through the steps of configuring self-hosted runners using Fedora CoreOS.
|
||||
### 入门
|
||||
|
||||
### Getting Started
|
||||
Fedora CoreOS 是一个精简的操作系统,旨在便于大规模的部署和维护。该操作系统会自动更新,并默认提供运行容器所需的工具。由于这些原因,Fedora CoreOS 是运行 CI/CD 工作流程的一个极佳选择。
|
||||
|
||||
Fedora CoreOS is a minimalist operating system designed to be easy to deploy and maintain at scale. The operating system will automaticaly update and provide, by default, the tools needed to run containers. For all of these reasons, Fedora CoreOS is a great choice to consider for running CI/CD workflows.
|
||||
配置和配备 Fedora CoreOS 机器的第一步是生成一个 [Ignition][6] 文件。[Butane][7] 允许你使用更友好的格式(YAML)生成 Ignition 文件。
|
||||
|
||||
The first step to configure and provision a Fedora CoreOS machine is to generate an [Ignition][6] file. [Butane][7] allows you to generate Ignition’s file using a friendlier format (YAML).
|
||||
#### 配置一个 Fedora CoreOS 运行器
|
||||
|
||||
#### Configure a Fedora CoreOS runner
|
||||
|
||||
To execute GitHub actions on Fedora CoreOS, the host needs the binaries and scripts used to register and run the runner. Download the binaries and scripts from the [actions runner project][8] and deploy under _/usr/local/sbin/actions-runner_.
|
||||
要在 Fedora CoreOS 上执行 GitHub Actions,托管主机需要用于注册和运行该运行器的二进制文件和脚本。从 [Actions 运行器项目][8] 下载二进制文件和脚本,并部署在 `/usr/local/sbin/actions-runner` 下。
|
||||
|
||||
```
|
||||
version: "1.3.0"
|
||||
@ -51,13 +49,13 @@ storage:
|
||||
name: core
|
||||
```
|
||||
|
||||
#### Registration and Removal token
|
||||
#### 注册和删除令牌
|
||||
|
||||
Configuring runners for a project requires a “token”. This prevents registering or removing self-hosted runners from projects without the correct permissions. Tokens provided by Github have a one hour expiration time. If the runner restarts after this time it will require a new registration token.
|
||||
为一个项目配置运行器需要一个“<ruby>令牌<rt>token</rt></ruby>”。这可以防止在没有正确权限的情况下从项目中注册或删除自托管的运行器。GitHub 提供的令牌有一个小时的过期时间。如果运行器在这个时间之后重新启动,它将需要一个新的注册令牌。
|
||||
|
||||
The token can be problematic, in particular with Fedora CoreOS automatic updates. The update process expects that the host will restart at least once every couple weeks after receiving new data.
|
||||
该令牌可能出问题,特别是在 Fedora CoreOS 自动更新时。更新过程希望托管主机在收到新数据后至少每隔几周重启一次。
|
||||
|
||||
Luckily, it is possible to use GitHub REST API to obtain these tokens and automatically configure the runner every time the host restarts. The following _manage-runner.sh_ script uses the APIs to retrieve a token, remove any runner already configured and register the runner with a new token.
|
||||
幸运的是,可以使用 GitHub REST API 来获取这些令牌,并在托管主机每次重启时自动配置运行器。下面的 `manage-runner.sh` 脚本使用 API 来获取令牌,删除任何已经配置好的运行器,并用新的令牌注册运行器。
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
@ -75,7 +73,7 @@ REGISTRATION_TOKEN=$(curl -u ${GITHUB_USER}:${GITHUB_TOKEN} -X POST -H "Accept:
|
||||
/usr/local/sbin/actions-runner/config.sh --url https://github.com/cverna/fcos-actions-runner --token ${REGISTRATION_TOKEN} --labels fcos --unattended
|
||||
```
|
||||
|
||||
The script above uses a few environment variables that contain a GitHub username and a [Personal Access Token][9] used to authenticate the REST API requests. The Personal Access Token requires the repo permissions in order to successfully retrieve the runner registration and removal tokens. The token is security sensitive so it is better to store it in a different file with stricter permissions. In this example that file is _actions-runner_.
|
||||
上面的脚本使用了一些环境变量,包含 GitHub 用户名和用于验证 REST API 请求的 <ruby>[个人访问令牌][9]<rt>Personal Access Token</rt></ruby>。个人访问令牌需要存储库权限,以便成功检索运行器的注册和移除令牌。该令牌是安全敏感信息,所以最好将其存储在一个具有更严格权限的不同文件中。在这个例子中,这个文件是 `actions-runner`。
|
||||
|
||||
```
|
||||
GITHUB_USER=<user>
|
||||
@ -83,7 +81,7 @@ GITHUB_REPO=<repo>
|
||||
GITHUB_TOKEN=<personal_access_token>
|
||||
```
|
||||
|
||||
Following is the Butane snippet that creates these two files – _manage-runner.sh_ and _actions-runner_.
|
||||
以下是创建这两个文件 `manage-runner.sh` 和 `actions-runner` 的 Butane 片段。
|
||||
|
||||
```
|
||||
- path: /usr/local/sbin/actions-runner/manage-runner.sh
|
||||
@ -104,9 +102,9 @@ Following is the Butane snippet that creates these two files – _manage-runner.
|
||||
name: core
|
||||
```
|
||||
|
||||
### Running Actions on Fedora CoreOS
|
||||
### 在 Fedora CoreOS 上运行 Actions
|
||||
|
||||
Finally, create the systemd services that will configure and start the runner. Define the services in the Butane configuration file.
|
||||
最后,创建用于配置和启动运行器的 systemd 服务。在 Butane 配置文件中定义这些服务。
|
||||
|
||||
```
|
||||
systemd:
|
||||
@ -142,21 +140,19 @@ systemd:
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
This creates two services, _github-runner-configure.service_ (running once when the host has finished booting) and _github-runner.service_ (running the Actions runner binaries and waiting for new CI/CD jobs).
|
||||
这将创建两个服务:`github-runner-configure.service`(在主机启动完成后运行一次)和 `github-runner.service`(运行 Actions 运行器二进制文件并等待新的 CI/CD 作业)。
|
||||
|
||||
Now that the Butane configuration is complete, generate an Ignition file out of it and provision a Fedora CoreOS Actions runner.
|
||||
现在 Butane 配置已经完成,从中生成一个 Ignition 文件并配备一个 Fedora CoreOS Actions 运行器。
|
||||
|
||||
```
|
||||
$ podman run -i --rm -v $PWD:/code:z --workdir /code quay.io/coreos/butane:release --pretty --strict --files-dir /code config.yaml -o config.ignition
|
||||
```
|
||||
|
||||
Once the Ignition file is generated, it can be used to provision a runner on the platforms where Fedora CoreOS is [available][10].
|
||||
一旦 Ignition 文件生成,它就可以用来在 [支持][10] Fedora CoreOS 的平台上配备一个运行器。
|
||||
|
||||
> [Getting started with Fedora CoreOS][11]
|
||||
### 配置一个 Action 来使用一个自托管的运行器
|
||||
|
||||
### Configure an Action to use a self-hosted runner
|
||||
|
||||
The following test Action workflow will test the FCOS self-hosted worker. Create the following file in your git repository _.github/workflows/main.yml_
|
||||
下面的测试 Action 工作流程将测试 FCOS 的自托管的运行器。在你的 git 存储库中创建以下文件 `.github/workflows/main.yml`。
|
||||
|
||||
```
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
@ -188,9 +184,9 @@ jobs:
|
||||
run: podman run --rm fedora-minimal:34 echo Hello World !
|
||||
```
|
||||
|
||||
Note that the _runs-on_ configuration is set up to use a runner with the label _fcos_.
|
||||
请注意,`runs-on` 的配置被设置为使用标签为 `fcos` 的运行器。
|
||||
|
||||
The code presented in this article is available [here][12].
|
||||
本文介绍的代码可以在 [这里][12] 中找到。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -198,8 +194,8 @@ via: https://fedoramagazine.org/run-github-actions-on-fedora-coreos/
|
||||
|
||||
作者:[Clément Verna][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
354
published/20210728 Kernel tracing with trace-cmd.md
Normal file
354
published/20210728 Kernel tracing with trace-cmd.md
Normal file
@ -0,0 +1,354 @@
|
||||
[#]: subject: (Kernel tracing with trace-cmd)
|
||||
[#]: via: (https://opensource.com/article/21/7/linux-kernel-trace-cmd)
|
||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (mengxinayan)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13852-1.html)
|
||||
|
||||
使用 trace-cmd 追踪内核
|
||||
======
|
||||
|
||||
> trace-cmd 是一个易于使用,且特性众多、可用来追踪内核函数的命令。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/05/145818d2i9tgjetzj8itqg.jpg)
|
||||
|
||||
在 [之前的文章][2] 里,我介绍了如何利用 `ftrace` 来追踪内核函数。通过写入和读出文件来使用 `ftrace` 会变得很枯燥,所以我对它做了一个封装来运行带有选项的命令,以启用和禁用追踪、设置过滤器、查看输出、清除输出等等。
|
||||
|
||||
[trace-cmd][3] 命令是一个可以帮助你做到这一点的工具。在这篇文章中,我使用 `trace-cmd` 来执行我在 `ftrace` 文章中所做的相同任务。由于会经常参考那篇文章,建议在阅读这篇文章之前先阅读它。
|
||||
|
||||
### 安装 trace-cmd
|
||||
|
||||
本文中所有的命令都运行在 root 用户下。
|
||||
|
||||
因为 `ftrace` 机制被内置于内核中,因此你可以使用下面的命令进行验证它是否启用:
|
||||
|
||||
```
|
||||
# mount | grep tracefs
|
||||
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
|
||||
```
|
||||
|
||||
不过,你需要手动尝试安装 `trace-cmd` 命令:
|
||||
|
||||
```
|
||||
# dnf install trace-cmd -y
|
||||
```
|
||||
|
||||
### 列出可用的追踪器
|
||||
|
||||
当使用 `ftrace` 时,你必须查看文件的内容以了解有哪些追踪器可用。但使用 `trace-cmd`,你可以通过以下方式获得这些信息:
|
||||
|
||||
```
|
||||
# trace-cmd list -t
|
||||
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
|
||||
```
|
||||
|
||||
### 启用函数追踪器
|
||||
|
||||
在我 [之前的文章][2] 中,我使用了两个追踪器,在这里我也会这么做。用 `function` 启用你的第一个追踪器:
|
||||
|
||||
```
|
||||
$ trace-cmd start -p function
|
||||
plugin 'function'
|
||||
```
|
||||
|
||||
### 查看追踪输出
|
||||
|
||||
一旦追踪器被启用,你可以通过使用 `show` 参数来查看输出。这只显示了前 20 行以保持例子的简短(见我之前的文章对输出的解释):
|
||||
|
||||
```
|
||||
# trace-cmd show | head -20
|
||||
## tracer: function
|
||||
#
|
||||
# entries-in-buffer/entries-written: 410142/3380032 #P:8
|
||||
#
|
||||
# _-----=> irqs-off
|
||||
# / _----=> need-resched
|
||||
# | / _---=> hardirq/softirq
|
||||
# || / _--=> preempt-depth
|
||||
# ||| / delay
|
||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||
# | | | |||| | |
|
||||
gdbus-2606 [004] ..s. 10520.538759: __msecs_to_jiffies <-rebalance_domains
|
||||
gdbus-2606 [004] ..s. 10520.538760: load_balance <-rebalance_domains
|
||||
gdbus-2606 [004] ..s. 10520.538761: idle_cpu <-load_balance
|
||||
gdbus-2606 [004] ..s. 10520.538762: group_balance_cpu <-load_balance
|
||||
gdbus-2606 [004] ..s. 10520.538762: find_busiest_group <-load_balance
|
||||
gdbus-2606 [004] ..s. 10520.538763: update_group_capacity <-update_sd_lb_stats.constprop.0
|
||||
gdbus-2606 [004] ..s. 10520.538763: __msecs_to_jiffies <-update_group_capacity
|
||||
gdbus-2606 [004] ..s. 10520.538765: idle_cpu <-update_sd_lb_stats.constprop.0
|
||||
gdbus-2606 [004] ..s. 10520.538766: __msecs_to_jiffies <-rebalance_domains
|
||||
```
|
||||
|
||||
### 停止追踪并清除缓冲区
|
||||
|
||||
追踪将会在后台继续运行,你可以继续用 `show` 查看输出。
|
||||
|
||||
要停止追踪,请运行带有 `stop` 参数的 `trace-cmd` 命令:
|
||||
|
||||
```
|
||||
# trace-cmd stop
|
||||
```
|
||||
|
||||
要清除缓冲区,用 `clear` 参数运行它:
|
||||
|
||||
```
|
||||
# trace-cmd clear
|
||||
```
|
||||
|
||||
### 启用函数调用图追踪器
|
||||
|
||||
运行第二个追踪器,通过 `function_graph` 参数来启用它。
|
||||
|
||||
```
|
||||
# trace-cmd start -p function_graph
|
||||
Plugin 'function_graph'
|
||||
```
|
||||
|
||||
再次使用 `show` 参数查看输出。正如预期的那样,输出与第一次追踪输出略有不同。这一次,它包括一个**函数调用**链:
|
||||
|
||||
```
|
||||
# trace-cmd show | head -20
|
||||
## tracer: function_graph
|
||||
#
|
||||
# CPU DURATION FUNCTION CALLS
|
||||
# | | | | | | |
|
||||
4) 0.079 us | } /* rcu_all_qs */
|
||||
4) 0.327 us | } /* __cond_resched */
|
||||
4) 0.081 us | rcu_read_unlock_strict();
|
||||
4) | __cond_resched() {
|
||||
4) 0.078 us | rcu_all_qs();
|
||||
4) 0.243 us | }
|
||||
4) 0.080 us | rcu_read_unlock_strict();
|
||||
4) | __cond_resched() {
|
||||
4) 0.078 us | rcu_all_qs();
|
||||
4) 0.241 us | }
|
||||
4) 0.080 us | rcu_read_unlock_strict();
|
||||
4) | __cond_resched() {
|
||||
4) 0.079 us | rcu_all_qs();
|
||||
4) 0.235 us | }
|
||||
4) 0.095 us | rcu_read_unlock_strict();
|
||||
4) | __cond_resched() {
|
||||
```
|
||||
|
||||
使用 `stop` 和 `clear` 命令来停止追踪和清除缓存区:
|
||||
|
||||
```
|
||||
# trace-cmd stop
|
||||
# trace-cmd clear
|
||||
```
|
||||
|
||||
### 调整追踪以增加深度
|
||||
|
||||
如果你想在函数调用中看到更多的深度,你可以对追踪器进行调整:
|
||||
|
||||
```
|
||||
# trace-cmd start -p function_graph --max-graph-depth 5
|
||||
plugin 'function_graph'
|
||||
```
|
||||
|
||||
现在,当你将这个输出与你之前看到的进行比较时,你应该看到更多的嵌套函数调用:
|
||||
|
||||
```
|
||||
# trace-cmd show | head -20
|
||||
## tracer: function_graph
|
||||
#
|
||||
# CPU DURATION FUNCTION CALLS
|
||||
# | | | | | | |
|
||||
6) | __fget_light() {
|
||||
6) 0.804 us | __fget_files();
|
||||
6) 2.708 us | }
|
||||
6) 3.650 us | } /* __fdget */
|
||||
6) 0.547 us | eventfd_poll();
|
||||
6) 0.535 us | fput();
|
||||
6) | __fdget() {
|
||||
6) | __fget_light() {
|
||||
6) 0.946 us | __fget_files();
|
||||
6) 1.895 us | }
|
||||
6) 2.849 us | }
|
||||
6) | sock_poll() {
|
||||
6) 0.651 us | unix_poll();
|
||||
6) 1.905 us | }
|
||||
6) 0.475 us | fput();
|
||||
6) | __fdget() {
|
||||
```
|
||||
|
||||
### 了解可被追踪的函数
|
||||
|
||||
如果你想只追踪某些函数而忽略其他的,你需要知道确切的函数名称。你可以用 `list -f` 参数来得到它们。例如搜索常见的内核函数 `kmalloc`,它被用来在内核中分配内存:
|
||||
|
||||
```
|
||||
# trace-cmd list -f | grep kmalloc
|
||||
bpf_map_kmalloc_node
|
||||
mempool_kmalloc
|
||||
__traceiter_kmalloc
|
||||
__traceiter_kmalloc_node
|
||||
kmalloc_slab
|
||||
kmalloc_order
|
||||
kmalloc_order_trace
|
||||
kmalloc_large_node
|
||||
__kmalloc
|
||||
__kmalloc_track_caller
|
||||
__kmalloc_node
|
||||
__kmalloc_node_track_caller
|
||||
[...]
|
||||
```
|
||||
|
||||
下面是我的测试系统中可被追踪的函数总数:
|
||||
|
||||
```
|
||||
# trace-cmd list -f | wc -l
|
||||
63165
|
||||
```
|
||||
|
||||
### 追踪内核模块相关的函数
|
||||
|
||||
你也可以追踪与特定内核模块相关的函数。假设你想追踪 `kvm` 内核模块相关的功能,你可以通过以下方式来实现。请确保该模块已经加载:
|
||||
|
||||
```
|
||||
# lsmod | grep kvm_intel
|
||||
kvm_intel 335872 0
|
||||
kvm 987136 1 kvm_intel
|
||||
```
|
||||
|
||||
再次运行 `trace-cmd`,使用 `list` 参数,并从输出结果中,`grep` 查找以 `]` 结尾的行。这将过滤掉内核模块。然后 `grep` 内核模块 `kvm_intel` ,你应该看到所有与该内核模块有关的函数。
|
||||
|
||||
```
|
||||
# trace-cmd list -f | grep ]$ | grep kvm_intel
|
||||
vmx_can_emulate_instruction [kvm_intel]
|
||||
vmx_update_emulated_instruction [kvm_intel]
|
||||
vmx_setup_uret_msr [kvm_intel]
|
||||
vmx_set_identity_map_addr [kvm_intel]
|
||||
handle_machine_check [kvm_intel]
|
||||
handle_triple_fault [kvm_intel]
|
||||
vmx_patch_hypercall [kvm_intel]
|
||||
|
||||
[...]
|
||||
|
||||
vmx_dump_dtsel [kvm_intel]
|
||||
vmx_dump_sel [kvm_intel]
|
||||
```
|
||||
|
||||
### 追踪特定函数
|
||||
|
||||
现在你知道了如何找到感兴趣的函数,请用一个例子把这些内容用于时间。就像前面的文章一样,试着追踪与文件系统相关的函数。我的测试系统上的文件系统是 `ext4`。
|
||||
|
||||
这个过程略有不同;你在运行命令时,不使用 `start` 参数,而是在 `record` 参数后面加上你想追踪的函数的“模式”。你还需要指定你想要的追踪器;在这种情况下,就是 `function_graph`。该命令会继续记录追踪,直到你用 `Ctrl+C` 停止它。所以几秒钟后,按 `Ctrl+C` 停止追踪:
|
||||
|
||||
```
|
||||
# trace-cmd list -f | grep ^ext4_
|
||||
|
||||
# trace-cmd record -l ext4_* -p function_graph
|
||||
plugin 'function_graph'
|
||||
Hit Ctrl^C to stop recording
|
||||
^C
|
||||
CPU0 data recorded at offset=0x856000
|
||||
8192 bytes in size
|
||||
[...]
|
||||
```
|
||||
|
||||
### 查看追踪记录
|
||||
|
||||
要查看你之前的追踪记录,运行带有 `report` 参数的命令。从输出结果来看,很明显过滤器起作用了,你只看到 `ext4` 相关的函数追踪:
|
||||
|
||||
```
|
||||
# trace-cmd report | head -20
|
||||
[...]
|
||||
cpus=8
|
||||
trace-cmd-12697 [000] 11303.928103: funcgraph_entry: | ext4_show_options() {
|
||||
trace-cmd-12697 [000] 11303.928104: funcgraph_entry: 0.187 us | ext4_get_dummy_policy();
|
||||
trace-cmd-12697 [000] 11303.928105: funcgraph_exit: 1.583 us | }
|
||||
trace-cmd-12697 [000] 11303.928122: funcgraph_entry: | ext4_create() {
|
||||
trace-cmd-12697 [000] 11303.928122: funcgraph_entry: | ext4_alloc_inode() {
|
||||
trace-cmd-12697 [000] 11303.928123: funcgraph_entry: 0.101 us | ext4_es_init_tree();
|
||||
trace-cmd-12697 [000] 11303.928123: funcgraph_entry: 0.083 us | ext4_init_pending_tree();
|
||||
trace-cmd-12697 [000] 11303.928123: funcgraph_entry: 0.141 us | ext4_fc_init_inode();
|
||||
trace-cmd-12697 [000] 11303.928123: funcgraph_exit: 0.931 us | }
|
||||
trace-cmd-12697 [000] 11303.928124: funcgraph_entry: 0.081 us | ext4_get_dummy_policy();
|
||||
trace-cmd-12697 [000] 11303.928124: funcgraph_entry: 0.133 us | ext4_get_group_desc();
|
||||
trace-cmd-12697 [000] 11303.928124: funcgraph_entry: 0.115 us | ext4_free_inodes_count();
|
||||
trace-cmd-12697 [000] 11303.928124: funcgraph_entry: 0.114 us | ext4_get_group_desc();
|
||||
```
|
||||
|
||||
### 追踪一个特定的 PID
|
||||
|
||||
假设你想追踪与一个进程(PID)有关的函数。打开另一个终端,注意运行中的 shell 的PID:
|
||||
|
||||
```
|
||||
# echo $$
|
||||
10885
|
||||
```
|
||||
|
||||
再次运行 `record` 命令,用 `-P` 选项传递PID。这一次,让终端运行(也就是说,先不要按 `Ctrl+C` ):
|
||||
|
||||
```
|
||||
# trace-cmd record -P 10885 -p function_graph
|
||||
Plugin 'function_graph'
|
||||
Hit Ctrl^C to stop recording
|
||||
```
|
||||
|
||||
### 在 shell 上运行一些命令
|
||||
|
||||
移动到另一个终端,在那里你有一个以特定 PID 运行的 shell,并运行任何命令,例如,`ls` 命令用来列出文件:
|
||||
|
||||
```
|
||||
# ls
|
||||
Temp-9b61f280-fdc1-4512-9211-5c60f764d702
|
||||
tracker-extract-3-files.1000
|
||||
v8-compile-cache-1000
|
||||
[...]
|
||||
```
|
||||
|
||||
移动到你启用追踪的终端,按 `Ctrl+C` 停止追踪:
|
||||
|
||||
```
|
||||
# trace-cmd record -P 10885 -p function_graph
|
||||
plugin 'function_graph'
|
||||
Hit Ctrl^C to stop recording
|
||||
^C
|
||||
CPU1 data recorded at offset=0x856000
|
||||
618496 bytes in size
|
||||
[...]
|
||||
```
|
||||
|
||||
在追踪的输出中,你可以看到左边是 PID 和 Bash shell,右边是与之相关的函数调用。这对于缩小你的追踪范围是非常方便的:
|
||||
|
||||
```
|
||||
# trace-cmd report | head -20
|
||||
|
||||
cpus=8
|
||||
<idle>-0 [001] 11555.380581: funcgraph_entry: | switch_mm_irqs_off() {
|
||||
<idle>-0 [001] 11555.380583: funcgraph_entry: 1.703 us | load_new_mm_cr3();
|
||||
<idle>-0 [001] 11555.380586: funcgraph_entry: 0.493 us | switch_ldt();
|
||||
<idle>-0 [001] 11555.380587: funcgraph_exit: 7.235 us | }
|
||||
bash-10885 [001] 11555.380589: funcgraph_entry: 1.046 us | finish_task_switch.isra.0();
|
||||
bash-10885 [001] 11555.380591: funcgraph_entry: | __fdget() {
|
||||
bash-10885 [001] 11555.380592: funcgraph_entry: 2.036 us | __fget_light();
|
||||
bash-10885 [001] 11555.380594: funcgraph_exit: 3.256 us | }
|
||||
bash-10885 [001] 11555.380595: funcgraph_entry: | tty_poll() {
|
||||
bash-10885 [001] 11555.380597: funcgraph_entry: | tty_ldisc_ref_wait() {
|
||||
bash-10885 [001] 11555.380598: funcgraph_entry: | ldsem_down_read() {
|
||||
bash-10885 [001] 11555.380598: funcgraph_entry: | __cond_resched() {
|
||||
```
|
||||
|
||||
### 试一试
|
||||
|
||||
这些简短的例子显示了使用 `trace-cmd` 命令而不是底层的 `ftrace` 机制,是如何实现既容易使用又拥有丰富的功能,许多内容本文并没有涉及。要想了解更多信息并更好地使用它,请查阅它的手册,并尝试使用其他有用的命令。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/linux-kernel-trace-cmd
|
||||
|
||||
作者:[Gaurav Kamathe][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/gkamathe
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen)
|
||||
[2]: https://linux.cn/article-13752-1.html
|
||||
[3]: https://lwn.net/Articles/410200/
|
@ -2,43 +2,41 @@
|
||||
[#]: via: "https://fedoramagazine.org/nmstate-a-declarative-networking-config-tool/"
|
||||
[#]: author: "Maurizio Garcia https://fedoramagazine.org/author/malgnuz/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13861-1.html"
|
||||
|
||||
NMState: A declarative networking config tool
|
||||
NMState:一个声明式网络配置工具
|
||||
======
|
||||
|
||||
![][1]
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/08/145714mqcyh6sshchomyot.jpg)
|
||||
|
||||
Comic excerpted from photo by [Bee Felten-Leidel][2] on [Unsplash][3]
|
||||
这篇文章描述并演示了 NMState,这是一个使用声明式方法配置主机的网络管理器。这意味着你可以通过 API 定义所需的配置状态,而工具则通过<ruby>提供者<rt>provider</rt></ruby>来应用配置。
|
||||
|
||||
This article describes and demonstrates NMState, a network manager that uses a declarative approach to configure hosts. This means you define the desired configuration state through an API and the tool applies the configuration through a provider.
|
||||
### 配置方法:命令式与声明式
|
||||
|
||||
### Configuration approaches: imperative vs declarative
|
||||
网络管理有时候是一项非常复杂的任务,这取决于环境的规模和多样性。在 IT 的早期,网络管理依赖于网络管理员在网络设备上手动执行命令。如今,<ruby>基础设施即代码<rt>Infrastructure as Code</rt></ruby>(IaC)允许以不同的方式将这些任务自动化。z这基本上有两种方法:命令式或声明式。
|
||||
|
||||
Networking management can be a very complex task depending on the size and diversity of the environment. In the early days of IT, networking management relied on manual procedures performed by network administrators over networking devices. Nowadays, Infrastructure as Code (IaC) allows automation of those tasks in a different way. There are, essentially two approaches: imperative or declarative.
|
||||
在命令式方法中,你会定义“如何”达到所需的配置状态。而在声明式范式里则定义了“什么”是所需的配置状态,所以它不确定哪些步骤是必需的,也不确定它们必须以何种顺序执行。这种方法目前正在聚集更多的人员参与,你可以在目前使用的大多数管理和编排工具上找到它。
|
||||
|
||||
In an imperative approach you define “how” you will arrive at a desired configuration state. The declarative paradigm defines “what” is the desired configuration state, so it does not shape which steps are required nor in which order they must be performed. This approach is currently gathering more adepts and you can find it on most of the management and orchestration tools currently used.
|
||||
### NMState:一个声明式的工具
|
||||
|
||||
### NMState: a declarative tool
|
||||
NMState 是一个网络管理器,允许你按照声明式方法配置主机。这意味着你通过一个北向的声明式 API 定义所需的配置状态,这个工具通过南向的<ruby>提供者<rt>provider</rt></ruby>应用配置。
|
||||
|
||||
NMState is a network manager that allows you to configure hosts following a declarative approach. It means you define the desired configuration state through a northbound declarative API and this tool applies the configuration through a southbound provider.
|
||||
目前 NMState 支持的唯一的提供者是 NetworkManager,它是为 Fedora Linux 提供网络功能的主要服务。不过,NMState 的开发计划中将逐渐增加其他提供者。
|
||||
|
||||
Currently the only provider supported by NMState is NetworkManager, which is the main service to address networking capabilities on Fedora Linux. However, the development life cycle of NMState will add other providers gradually.
|
||||
关于 NMState 的进一步信息,请访问其项目 [站点][4] 或 GitHub [仓库][5]。
|
||||
|
||||
For further information regarding NMState please visit either its project [site][4] or github [repository][5].
|
||||
### 安装
|
||||
|
||||
### Installation
|
||||
|
||||
NMState is available on Fedora Linux 29+ and requires NetworkManager 1.26 or later installed and running on the system. The following shows the installation on Fedora Linux 34:
|
||||
NMState 在 Fedora Linux 29+ 上可用,需要在系统上安装并运行 NetworkManager 1.26 或更高版本。下面是在 Fedora Linux 34 上的安装情况:
|
||||
|
||||
```
|
||||
$ sudo dnf -y install nmstate
|
||||
…
|
||||
output omitted
|
||||
…
|
||||
...
|
||||
输出节略
|
||||
...
|
||||
Installed:
|
||||
NetworkManager-config-server-1:1.30.4-1.fc34.noarch gobject-introspection-1.68.0-3.fc34.x86_64 nispor-1.0.1-2.fc34.x86_64 nmstate-1.0.3-2.fc34.noarch
|
||||
python3-gobject-base-3.40.1-1.fc34.x86_64 python3-libnmstate-1.0.3-2.fc34.noarch python3-nispor-1.0.1-2.fc34.noarch python3-varlink-30.3.1-2.fc34.noarch
|
||||
@ -46,18 +44,18 @@ Installed:
|
||||
Complete!
|
||||
```
|
||||
|
||||
At this point you can use _nmstatectl_ as a command line tool for NMState. Please refer to either _nmstatectl –help_ or _man nmstatectl_ for further information about this tool.
|
||||
这样,你可以使用 `nmstatectl` 作为 NMState 的命令行工具。请参考 `nmstatectl -help` 或 `man nmstatectl` 以了解关于这个工具的进一步信息。
|
||||
|
||||
### Using NMstate
|
||||
### 使用 NMstate
|
||||
|
||||
Start by checking the NMState version installed in the system:
|
||||
首先要检查系统中安装的 NMState 版本:
|
||||
|
||||
```
|
||||
$ nmstatectl version
|
||||
1.0.3
|
||||
```
|
||||
|
||||
Check the current configuration of a networking interface, e.g. the _eth0_ configuration:
|
||||
检查一个网络接口的当前配置,例如 `eth0` 的配置:
|
||||
|
||||
```
|
||||
$ nmstatectl show eth0
|
||||
@ -124,29 +122,23 @@ interfaces:
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
As you can see above the networking configuration shows four main sections:
|
||||
正如你在上面看到的,这个网络配置显示了四个主要部分:
|
||||
|
||||
* **dns-resolver**: this section has the nameserver configuration for this interface.
|
||||
* **route-rules**: it states the routing rules.
|
||||
* **routes**: it includes both dynamic and static routes.
|
||||
* **Interfaces**: this section describes both ipv4 and ipv6 settings.
|
||||
* `dns-resolver`:这部分是这个接口的名字服务器配置。
|
||||
* `route-rules`:它说明了路由规则。
|
||||
* `routes`:它包括动态和静态路由。
|
||||
* `interfaces`:这部分描述了 ipv4 和 ipv6 设置。
|
||||
|
||||
### 修改配置
|
||||
|
||||
你可以在两种模式下修改所需的配置状态:
|
||||
|
||||
### Modify the configuration
|
||||
* 交互式:通过 `nmstatectl edit` 编辑接口配置。这个命令调用环境变量 `EDITOR` 定义的文本编辑器,因此可以用 yaml 格式编辑网络状态。完成编辑后,NMState 将应用新的网络配置,除非有语法错误。
|
||||
* 基于文件的:使用 `nmstatectl apply` 应用接口配置,它从先前创建的 yaml 或 json 文件中导入一个所需的配置状态。
|
||||
|
||||
You can modify the desired configuration state in two modes:
|
||||
下面几节告诉你如何使用 NMState 来改变网络配置。这些改变可能会对系统造成破坏,所以建议在测试系统或客户虚拟机上执行这些任务,直到你对 NMState 有更好的理解。
|
||||
|
||||
* **Interactive**: editing the interface configuration through _nmstatectl edit_. This command invokes the text editor defined by the environment variable EDITOR so the network state can be edited in yaml format. After finishing the edition NMState will apply the new network configuration unless there are syntax errors.
|
||||
|
||||
|
||||
* **File-based**: applying the interface configuration using _nmstatectl apply_ which imports a desired configuration state from a yaml or json file earlier created.
|
||||
|
||||
|
||||
|
||||
The following sections show you how to change the networking configuration using NMState. These changes can be disruptive to the system so the recommendation is to perform these tasks on a test system or guest VM till you get a better understanding of NMState.
|
||||
|
||||
The test system in use herehas two Ethernet interfaces: _eth0_ and _eth1_:
|
||||
这里使用的测试系统有两个以太网接口,`eth0` 和 `eth1`:
|
||||
|
||||
```
|
||||
$ ip -br -4 a
|
||||
@ -155,11 +147,9 @@ eth0 UP 192.168.122.238/24
|
||||
eth1 UP 192.168.122.108/24
|
||||
```
|
||||
|
||||
#### Example of interactive configuration mode:
|
||||
#### 互动配置模式的例子
|
||||
|
||||
```
|
||||
Change the MTU of eth0 interface to 9000 bytes using the nmstatectl edit command as follows (all changes are in bold):
|
||||
```
|
||||
使用 `nmstatectl edit` 命令将 `eth0` 接口的 MTU 改为 9000 字节,如下所示:
|
||||
|
||||
```
|
||||
$ sudo nmstatectl edit eth0
|
||||
@ -222,7 +212,7 @@ interfaces:
|
||||
mtu: 9000
|
||||
```
|
||||
|
||||
After saving and exiting the edito, NMState applies the new network desired state:
|
||||
在保存并退出编辑器后,NMState 应用新的网络期望状态:
|
||||
|
||||
```
|
||||
2021-06-29 11:29:05,726 root DEBUG Nmstate version: 1.0.3
|
||||
@ -232,7 +222,7 @@ After saving and exiting the edito, NMState applies the new network desired stat
|
||||
2021-06-29 11:29:05,792 root DEBUG Async action: Update profile uuid:2bdee700-f62b-365a-bd1d-69d9c31a9f0c iface:eth0 type:ethernet finished
|
||||
```
|
||||
|
||||
Now, use both the _ip_ command and also the _eth0_ configuration file to check that the _MTU_ of _eth0_ is 9000 bytes.
|
||||
现在,使用 `ip` 命令和 `eth0` 的配置文件来检查 `eth0` 的 `MTU` 是不是 9000 字节。
|
||||
|
||||
```
|
||||
$ ip link show eth0
|
||||
@ -273,11 +263,11 @@ ra-timeout=2147483647
|
||||
[proxy]
|
||||
```
|
||||
|
||||
#### Example of file-based configuration mode:
|
||||
#### 基于文件的配置模式的例子
|
||||
|
||||
Let’s use the file-based approach to set a new config state. In this case disable the IPv6 configuration in _eth1_ interface.
|
||||
让我们使用基于文件的方法来设置一个新的配置状态。这里我们禁用 `eth1` 接口的 IPv6 配置。
|
||||
|
||||
First, create a yaml file to define the desired state of the _eth1_ interface. Use _nmstatectl show_ to save the current settings then _nmstatectl edit_ to disable IPv6. Again, all changes are in bold and deletions are shown with strike-through:
|
||||
首先,创建一个 yaml 文件来定义 `eth1` 接口的期望状态。使用 `nmstatectl show` 来保存当前设置,然后使用 `nmstatectl edit` 来禁用 IPv6。
|
||||
|
||||
```
|
||||
$ nmstatectl show eth1 > eth1.yaml
|
||||
@ -341,7 +331,7 @@ interfaces:
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
After saving the new configuration, use it to apply the new state:
|
||||
保存新的配置后,用它来应用新的状态:
|
||||
|
||||
```
|
||||
$ sudo nmstatectl apply eth1.yaml
|
||||
@ -402,7 +392,7 @@ interfaces:
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
You can check that the _eth1_ interface does not have any IPv6 configured:
|
||||
你可以检查看到 `eth1` 接口没有配置任何 IPv6:
|
||||
|
||||
```
|
||||
$ ip -br a
|
||||
@ -440,11 +430,11 @@ method=disabled
|
||||
[proxy]
|
||||
```
|
||||
|
||||
#### Applying changes temporarily
|
||||
#### 临时应用改变
|
||||
|
||||
An interesting feature of NMState allows you to configure a desired networking state temporarily. In case you are satisfied with the configuration you can commit it afterwards. Otherwise it will rollback when the timeout expires (default is 60 sec).
|
||||
NMState 的一个有趣的功能允许你临时配置一个期望的网络状态。如果你对这个配置感到满意,你可以事后提交。否则,当超时(默认为 60 秒)过后,它将回滚。
|
||||
|
||||
Modify the _eth1_ configuration from the previous example so it has an IPv4 static address instead of getting it dynamically by DHCP.
|
||||
修改前面例子中的 `eth1` 配置,使它有一个 IPv4 静态地址,而不是通过 DHCP 动态获得。
|
||||
|
||||
```
|
||||
$ vi eth1.yaml
|
||||
@ -498,7 +488,7 @@ interfaces:
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
Now, apply this config temporarily using the option _no-commit_ so it will be valid only for 30 seconds. This can be done adding the option _–timeout_. Meanwhile, we will run the _ip -br a_ command three times to see how the IPv4 address configured in _eth1_ interface changes and then the configuration rolls back.
|
||||
现在,使用选项 `no-commit` 临时应用这个配置,让它只在 30 秒内有效。这可以通过添加选项 `timeout` 来完成。同时,我们将运行 `ip -br a` 命令三次,看看配置在 `eth1` 接口的 IPv4 地址是如何变化的,然后配置就会回滚。
|
||||
|
||||
```
|
||||
$ ip -br a && sudo nmstatectl apply --no-commit --timeout 30 eth1.yaml && sleep 10 && ip -br a && sleep 25 && ip -br a
|
||||
@ -561,13 +551,13 @@ eth0 UP 192.168.122.238/24 fe80::5054:ff:fe91:e44e/64
|
||||
eth1 UP 192.168.122.108/24
|
||||
```
|
||||
|
||||
As you can see from above, the _eth1_ IP address changed temporarily from 192.168.122.108 to 192.168.122.110 and then it returned to 192.168.122.108 after the timeout expired.
|
||||
从上面可以看到,`eth1` 的 IP 地址从 `192.168.122.108` 暂时变成了 `192.168.122.110`,然后在超时结束后又回到了 `192.168.122.108`。
|
||||
|
||||
### Conclusion
|
||||
### 总结
|
||||
|
||||
NMState is a declarative networking configuration tool that currently applies the desired networking configuration state in a host through the NetworkManager API. This state can be defined either interactively using a text editor or with a file-based approach creating a yaml or json file.
|
||||
NMState 是一个声明式的网络配置工具,目前可以通过 NetworkManager API 在主机中应用所需的网络配置状态。这种状态既可以用文本编辑器交互式地定义,也可以用基于文件的方法创建一个 yaml 或 json 文件。
|
||||
|
||||
This kind of tool provides Infrastructure as Code, it allows the automation of networking tasks and also reduces potential misconfigurations or unstable networking scenarios that could arise using legacy configuration methods.
|
||||
这种工具提供了“基础设施即代码”,它可以自动化网络任务,也减少了使用传统配置方法可能出现的潜在错误配置或不稳定的网络情况。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -575,8 +565,8 @@ via: https://fedoramagazine.org/nmstate-a-declarative-networking-config-tool/
|
||||
|
||||
作者:[Maurizio Garcia][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,666 @@
|
||||
[#]: subject: "Code memory safety and efficiency by example"
|
||||
[#]: via: "https://opensource.com/article/21/8/memory-programming-c"
|
||||
[#]: author: "Marty Kalin https://opensource.com/users/mkalindepauledu"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "unigeorge"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13845-1.html"
|
||||
|
||||
实例讲解代码之内存安全与效率
|
||||
======
|
||||
|
||||
> 了解有关内存安全和效率的更多信息。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/03/101238cd0hgdrhamzab7hj.jpg)
|
||||
|
||||
C 是一种高级语言,同时具有“<ruby>接近金属<rt>close-to-the-metal</rt></ruby>”(LCTT 译注:即“接近人类思维方式”的反义词)的特性,这使得它有时看起来更像是一种可移植的汇编语言,而不像 Java 或 Python 这样的兄弟语言。内存管理作为上述特性之一,涵盖了正在执行的程序对内存的安全和高效使用。本文通过 C 语言代码示例,以及现代 C 语言编译器生成的汇编语言代码段,详细介绍了内存安全性和效率。
|
||||
|
||||
尽管代码示例是用 C 语言编写的,但安全高效的内存管理指南对于 C++ 是同样适用的。这两种语言在很多细节上有所不同(例如,C++ 具有 C 所缺乏的面向对象特性和泛型),但在内存管理方面面临的挑战是一样的。
|
||||
|
||||
### 执行中程序的内存概述
|
||||
|
||||
对于正在执行的程序(又名 _<ruby>进程<rt>process</rt></ruby>_),内存被划分为三个区域:**<ruby>栈<rt>stack</rt></ruby>**、**<ruby>堆<rt>heap</rt></ruby>** 和 **<ruby>静态区<rt>static area</rt></ryby>**。下文会给出每个区域的概述,以及完整的代码示例。
|
||||
|
||||
作为通用 CPU 寄存器的替补,_栈_ 为代码块(例如函数或循环体)中的局部变量提供暂存器存储。传递给函数的参数在此上下文中也视作局部变量。看一下下面这个简短的示例:
|
||||
|
||||
```
|
||||
void some_func(int a, int b) {
|
||||
int n;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
通过 `a` 和 `b` 传递的参数以及局部变量 `n` 的存储会在栈中,除非编译器可以找到通用寄存器。编译器倾向于优先将通用寄存器用作暂存器,因为 CPU 对这些寄存器的访问速度很快(一个时钟周期)。然而,这些寄存器在台式机、笔记本电脑和手持机器的标准架构上很少(大约 16 个)。
|
||||
|
||||
在只有汇编语言程序员才能看到的实施层面,栈被组织为具有 `push`(插入)和 `pop`(删除)操作的 LIFO(后进先出)列表。 `top` 指针可以作为偏移的基地址;这样,除了 `top` 之外的栈位置也变得可访问了。例如,表达式 `top+16` 指向堆栈的 `top` 指针上方 16 个字节的位置,表达式 `top-16` 指向 `top` 指针下方 16 个字节的位置。因此,可以通过 `top` 指针访问实现了暂存器存储的栈的位置。在标准的 ARM 或 Intel 架构中,栈从高内存地址增长到低内存地址;因此,减小某进程的 `top` 就是增大其栈规模。
|
||||
|
||||
使用栈结构就意味着轻松高效地使用内存。编译器(而非程序员)会编写管理栈的代码,管理过程通过分配和释放所需的暂存器存储来实现;程序员声明函数参数和局部变量,将实现过程交给编译器。此外,完全相同的栈存储可以在连续的函数调用和代码块(如循环)中重复使用。精心设计的模块化代码会将栈存储作为暂存器的首选内存选项,同时优化编译器要尽可能使用通用寄存器而不是栈。
|
||||
|
||||
**堆** 提供的存储是通过程序员代码显式分配的,堆分配的语法因语言而异。在 C 中,成功调用库函数 `malloc`(或其变体 `calloc` 等)会分配指定数量的字节(在 C++ 和 Java 等语言中,`new` 运算符具有相同的用途)。编程语言在如何释放堆分配的存储方面有着巨大的差异:
|
||||
|
||||
* 在 Java、Go、Lisp 和 Python 等语言中,程序员不会显式释放动态分配的堆存储。
|
||||
|
||||
例如,下面这个 Java 语句为一个字符串分配了堆存储,并将这个堆存储的地址存储在变量 `greeting` 中:
|
||||
|
||||
```
|
||||
String greeting = new String("Hello, world!");
|
||||
```
|
||||
|
||||
Java 有一个垃圾回收器,它是一个运行时实用程序,如果进程无法再访问自己分配的堆存储,回收器可以使其自动释放。因此,Java 堆释放是通过垃圾收集器自动进行的。在上面的示例中,垃圾收集器将在变量 `greeting` 超出作用域后,释放字符串的堆存储。
|
||||
|
||||
* Rust 编译器会编写堆释放代码。这是 Rust 在不依赖垃圾回收器的情况下,使堆释放实现自动化的开创性努力,但这也会带来运行时复杂性和开销。向 Rust 的努力致敬!
|
||||
* 在 C(和 C++)中,堆释放是程序员的任务。程序员调用 `malloc` 分配堆存储,然后负责相应地调用库函数 `free` 来释放该存储空间(在 C++ 中,`new` 运算符分配堆存储,而 `delete` 和 `delete[]` 运算符释放此类存储)。下面是一个 C 语言代码示例:
|
||||
|
||||
```
|
||||
char* greeting = malloc(14); /* 14 heap bytes */
|
||||
strcpy(greeting, "Hello, world!"); /* copy greeting into bytes */
|
||||
puts(greeting); /* print greeting */
|
||||
free(greeting); /* free malloced bytes */
|
||||
```
|
||||
|
||||
C 语言避免了垃圾回收器的成本和复杂性,但也不过是让程序员承担了堆释放的任务。
|
||||
|
||||
内存的 **静态区** 为可执行代码(例如 C 语言函数)、字符串文字(例如“Hello, world!”)和全局变量提供存储空间:
|
||||
|
||||
```
|
||||
int n; /* global variable */
|
||||
int main() { /* function */
|
||||
char* msg = "No comment"; /* string literal */
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
该区域是静态的,因为它的大小从进程执行开始到结束都固定不变。由于静态区相当于进程固定大小的内存占用,因此经验法则是通过避免使用全局数组等方法来使该区域尽可能小。
|
||||
|
||||
下文会结合代码示例对本节概述展开进一步讲解。
|
||||
|
||||
### 栈存储
|
||||
|
||||
想象一个有各种连续执行的任务的程序,任务包括了处理每隔几分钟通过网络下载并存储在本地文件中的数字数据。下面的 `stack` 程序简化了处理流程(仅是将奇数整数值转换为偶数),而将重点放在栈存储的好处上。
|
||||
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Infile "incoming.dat"
|
||||
#define Outfile "outgoing.dat"
|
||||
#define IntCount 128000 /* 128,000 */
|
||||
|
||||
void other_task1() { /*...*/ }
|
||||
void other_task2() { /*...*/ }
|
||||
|
||||
void process_data(const char* infile,
|
||||
const char* outfile,
|
||||
const unsigned n) {
|
||||
int nums[n];
|
||||
FILE* input = fopen(infile, "r");
|
||||
if (NULL == infile) return;
|
||||
FILE* output = fopen(outfile, "w");
|
||||
if (NULL == output) {
|
||||
fclose(input);
|
||||
return;
|
||||
}
|
||||
|
||||
fread(nums, n, sizeof(int), input); /* read input data */
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (1 == (nums[i] & 0x1)) /* odd parity? */
|
||||
nums[i]--; /* make even */
|
||||
}
|
||||
fclose(input); /* close input file */
|
||||
|
||||
fwrite(nums, n, sizeof(int), output);
|
||||
fclose(output);
|
||||
}
|
||||
|
||||
int main() {
|
||||
process_data(Infile, Outfile, IntCount);
|
||||
|
||||
/** now perform other tasks **/
|
||||
other_task1(); /* automatically released stack storage available */
|
||||
other_task2(); /* ditto */
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
底部的 `main` 函数首先调用 `process_data` 函数,该函数会创建一个基于栈的数组,其大小由参数 `n` 给定(当前示例中为 128,000)。因此,该数组占用 `128000 * sizeof(int)` 个字节,在标准设备上达到了 512,000 字节(`int` 在这些设备上是四个字节)。然后数据会被读入数组(使用库函数 `fread`),循环处理,并保存到本地文件 `outgoing.dat`(使用库函数 `fwrite`)。
|
||||
|
||||
当 `process_data` 函数返回到其调用者 `main` 函数时,`process_data` 函数的大约 500MB 栈暂存器可供 `stack` 程序中的其他函数用作暂存器。在此示例中,`main` 函数接下来调用存根函数 `other_task1` 和 `other_task2`。这三个函数在 `main` 中依次调用,这意味着所有三个函数都可以使用相同的堆栈存储作为暂存器。因为编写栈管理代码的是编译器而不是程序员,所以这种方法对程序员来说既高效又容易。
|
||||
|
||||
在 C 语言中,在块(例如函数或循环体)内定义的任何变量默认都有一个 `auto` 存储类,这意味着该变量是基于栈的。存储类 `register` 现在已经过时了,因为 C 编译器会主动尝试尽可能使用 CPU 寄存器。只有在块内定义的变量可能是 `register`,如果没有可用的 CPU 寄存器,编译器会将其更改为 `auto`。基于栈的编程可能是不错的首选方式,但这种风格确实有一些挑战性。下面的 `badStack` 程序说明了这点。
|
||||
|
||||
```
|
||||
#include <stdio.h>;
|
||||
|
||||
const int* get_array(const unsigned n) {
|
||||
int arr[n]; /* stack-based array */
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++) arr[i] = 1 + 1;
|
||||
|
||||
return arr; /** ERROR **/
|
||||
}
|
||||
|
||||
int main() {
|
||||
const unsigned n = 16;
|
||||
const int* ptr = get_array(n);
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++) printf("%i ", ptr[i]);
|
||||
puts("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
`badStack` 程序中的控制流程很简单。`main` 函数使用 16(LCTT 译注:原文为 128,应为作者笔误)作为参数调用函数 `get_array`,然后被调用函数会使用传入参数来创建对应大小的本地数组。`get_array` 函数会初始化数组并返回给 `main` 中的数组标识符 `arr`。 `arr` 是一个指针常量,保存数组的第一个 `int` 元素的地址。
|
||||
|
||||
当然,本地数组 `arr` 可以在 `get_array` 函数中访问,但是一旦 `get_array` 返回,就不能合法访问该数组。尽管如此,`main` 函数会尝试使用函数 `get_array` 返回的堆栈地址 `arr` 来打印基于栈的数组。现代编译器会警告错误。例如,下面是来自 GNU 编译器的警告:
|
||||
|
||||
```
|
||||
badStack.c: In function 'get_array':
|
||||
badStack.c:9:10: warning: function returns address of local variable [-Wreturn-local-addr]
|
||||
return arr; /** ERROR **/
|
||||
```
|
||||
|
||||
一般规则是,如果使用栈存储实现局部变量,应该仅在该变量所在的代码块内,访问这块基于栈的存储(在本例中,数组指针 `arr` 和循环计数器 `i` 均为这样的局部变量)。因此,函数永远不应该返回指向基于栈存储的指针。
|
||||
|
||||
### 堆存储
|
||||
|
||||
接下来使用若干代码示例凸显在 C 语言中使用堆存储的优点。在第一个示例中,使用了最优方案分配、使用和释放堆存储。第二个示例(在下一节中)将堆存储嵌套在了其他堆存储中,这会使其释放操作变得复杂。
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int* get_heap_array(unsigned n) {
|
||||
int* heap_nums = malloc(sizeof(int) * n);
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++)
|
||||
heap_nums[i] = i + 1; /* initialize the array */
|
||||
|
||||
/* stack storage for variables heap_nums and i released
|
||||
automatically when get_num_array returns */
|
||||
return heap_nums; /* return (copy of) the pointer */
|
||||
}
|
||||
|
||||
int main() {
|
||||
unsigned n = 100, i;
|
||||
int* heap_nums = get_heap_array(n); /* save returned address */
|
||||
|
||||
if (NULL == heap_nums) /* malloc failed */
|
||||
fprintf(stderr, "%s\n", "malloc(...) failed...");
|
||||
else {
|
||||
for (i = 0; i < n; i++) printf("%i\n", heap_nums[i]);
|
||||
free(heap_nums); /* free the heap storage */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
上面的 `heap` 程序有两个函数: `main` 函数使用参数(示例中为 100)调用 `get_heap_array` 函数,参数用来指定数组应该有多少个 `int` 元素。因为堆分配可能会失败,`main` 函数会检查 `get_heap_array` 是否返回了 `NULL`;如果是,则表示失败。如果分配成功,`main` 将打印数组中的 `int` 值,然后立即调用库函数 `free` 来对堆存储解除分配。这就是最优的方案。
|
||||
|
||||
`get_heap_array` 函数以下列语句开头,该语句值得仔细研究一下:
|
||||
|
||||
```
|
||||
int* heap_nums = malloc(sizeof(int) * n); /* heap allocation */
|
||||
```
|
||||
|
||||
`malloc` 库函数及其变体函数针对字节进行操作;因此,`malloc` 的参数是 `n` 个 `int` 类型元素所需的字节数(`sizeof(int)` 在标准现代设备上是四个字节)。`malloc` 函数返回所分配字节段的首地址,如果失败则返回 `NULL` .
|
||||
|
||||
如果成功调用 `malloc`,在现代台式机上其返回的地址大小为 64 位。在手持设备和早些时候的台式机上,该地址的大小可能是 32 位,或者甚至更小,具体取决于其年代。堆分配数组中的元素是 `int` 类型,这是一个四字节的有符号整数。这些堆分配的 `int` 的地址存储在基于栈的局部变量 `heap_nums` 中。可以参考下图:
|
||||
|
||||
```
|
||||
heap-based
|
||||
stack-based /
|
||||
\ +----+----+ +----+
|
||||
heap-nums--->|int1|int2|...|intN|
|
||||
+----+----+ +----+
|
||||
```
|
||||
|
||||
一旦 `get_heap_array` 函数返回,指针变量 `heap_nums` 的栈存储将自动回收——但动态 `int` 数组的堆存储仍然存在,这就是 `get_heap_array` 函数返回这个地址(的副本)给 `main` 函数的原因:它现在负责在打印数组的整数后,通过调用库函数 `free` 显式释放堆存储:
|
||||
|
||||
```
|
||||
free(heap_nums); /* free the heap storage */
|
||||
```
|
||||
|
||||
`malloc` 函数不会初始化堆分配的存储空间,因此里面是随机值。相比之下,其变体函数 `calloc` 会将分配的存储初始化为零。这两个函数都返回 `NULL` 来表示分配失败。
|
||||
|
||||
在 `heap` 示例中,`main` 函数在调用 `free` 后会立即返回,正在执行的程序会终止,这会让系统回收所有已分配的堆存储。尽管如此,程序员应该养成在不再需要时立即显式释放堆存储的习惯。
|
||||
|
||||
### 嵌套堆分配
|
||||
|
||||
下一个代码示例会更棘手一些。C 语言有很多返回指向堆存储的指针的库函数。下面是一个常见的使用情景:
|
||||
|
||||
1、C 程序调用一个库函数,该函数返回一个指向基于堆的存储的指针,而指向的存储通常是一个聚合体,如数组或结构体:
|
||||
|
||||
```
|
||||
SomeStructure* ptr = lib_function(); /* returns pointer to heap storage */
|
||||
```
|
||||
|
||||
2、 然后程序使用所分配的存储。
|
||||
|
||||
3、 对于清理而言,问题是对 `free` 的简单调用是否会清理库函数分配的所有堆分配存储。例如,`SomeStructure` 实例可能有指向堆分配存储的字段。一个特别麻烦的情况是动态分配的结构体数组,每个结构体有一个指向又一层动态分配的存储的字段。下面的代码示例说明了这个问题,并重点关注了如何设计一个可以安全地为客户端提供堆分配存储的库。
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned id;
|
||||
unsigned len;
|
||||
float* heap_nums;
|
||||
} HeapStruct;
|
||||
unsigned structId = 1;
|
||||
|
||||
HeapStruct* get_heap_struct(unsigned n) {
|
||||
/* Try to allocate a HeapStruct. */
|
||||
HeapStruct* heap_struct = malloc(sizeof(HeapStruct));
|
||||
if (NULL == heap_struct) /* failure? */
|
||||
return NULL; /* if so, return NULL */
|
||||
|
||||
/* Try to allocate floating-point aggregate within HeapStruct. */
|
||||
heap_struct->heap_nums = malloc(sizeof(float) * n);
|
||||
if (NULL == heap_struct->heap_nums) { /* failure? */
|
||||
free(heap_struct); /* if so, first free the HeapStruct */
|
||||
return NULL; /* then return NULL */
|
||||
}
|
||||
|
||||
/* Success: set fields */
|
||||
heap_struct->id = structId++;
|
||||
heap_struct->len = n;
|
||||
|
||||
return heap_struct; /* return pointer to allocated HeapStruct */
|
||||
}
|
||||
|
||||
void free_all(HeapStruct* heap_struct) {
|
||||
if (NULL == heap_struct) /* NULL pointer? */
|
||||
return; /* if so, do nothing */
|
||||
|
||||
free(heap_struct->heap_nums); /* first free encapsulated aggregate */
|
||||
free(heap_struct); /* then free containing structure */
|
||||
}
|
||||
|
||||
int main() {
|
||||
const unsigned n = 100;
|
||||
HeapStruct* hs = get_heap_struct(n); /* get structure with N floats */
|
||||
|
||||
/* Do some (meaningless) work for demo. */
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++) hs->heap_nums[i] = 3.14 + (float) i;
|
||||
for (i = 0; i < n; i += 10) printf("%12f\n", hs->heap_nums[i]);
|
||||
|
||||
free_all(hs); /* free dynamically allocated storage */
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
上面的 `nestedHeap` 程序示例以结构体 `HeapStruct` 为中心,结构体中又有名为 `heap_nums` 的指针字段:
|
||||
|
||||
```
|
||||
typedef struct {
|
||||
unsigned id;
|
||||
unsigned len;
|
||||
float* heap_nums; /** pointer **/
|
||||
} HeapStruct;
|
||||
```
|
||||
|
||||
函数 `get_heap_struct` 尝试为 `HeapStruct` 实例分配堆存储,这需要为字段 `heap_nums` 指向的若干个 `float` 变量分配堆存储。如果成功调用 `get_heap_struct` 函数,并将指向堆分配结构体的指针以 `hs` 命名,其结果可以描述如下:
|
||||
|
||||
```
|
||||
hs-->HeapStruct instance
|
||||
id
|
||||
len
|
||||
heap_nums-->N contiguous float elements
|
||||
```
|
||||
|
||||
在 `get_heap_struct` 函数中,第一个堆分配过程很简单:
|
||||
|
||||
```
|
||||
HeapStruct* heap_struct = malloc(sizeof(HeapStruct));
|
||||
if (NULL == heap_struct) /* failure? */
|
||||
return NULL; /* if so, return NULL */
|
||||
```
|
||||
|
||||
`sizeof(HeapStruct)` 包括了 `heap_nums` 字段的字节数(32 位机器上为 4,64 位机器上为 8),`heap_nums` 字段则是指向动态分配数组中的 `float` 元素的指针。那么,问题关键在于 `malloc` 为这个结构体传送了字节空间还是表示失败的 `NULL`;如果是 `NULL`,`get_heap_struct` 函数就也返回 `NULL` 以通知调用者堆分配失败。
|
||||
|
||||
第二步尝试堆分配的过程更复杂,因为在这一步,`HeapStruct` 的堆存储已经分配好了:
|
||||
|
||||
```
|
||||
heap_struct->heap_nums = malloc(sizeof(float) * n);
|
||||
if (NULL == heap_struct->heap_nums) { /* failure? */
|
||||
free(heap_struct); /* if so, first free the HeapStruct */
|
||||
return NULL; /* and then return NULL */
|
||||
}
|
||||
```
|
||||
|
||||
传递给 `get_heap_struct` 函数的参数 `n` 指明动态分配的 `heap_nums` 数组中应该有多少个 `float` 元素。如果可以分配所需的若干个 `float` 元素,则该函数在返回 `HeapStruct` 的堆地址之前会设置结构的 `id` 和 `len` 字段。 但是,如果尝试分配失败,则需要两个步骤来实现最优方案:
|
||||
|
||||
1、 必须释放 `HeapStruct` 的存储以避免内存泄漏。对于调用 `get_heap_struct` 的客户端函数而言,没有动态 `heap_nums` 数组的 `HeapStruct` 可能就是没用的;因此,`HeapStruct` 实例的字节空间应该显式释放,以便系统可以回收这些空间用于未来的堆分配。
|
||||
|
||||
2、 返回 `NULL` 以标识失败。
|
||||
|
||||
如果成功调用 `get_heap_struct` 函数,那么释放堆存储也很棘手,因为它涉及要以正确顺序进行的两次 `free` 操作。因此,该程序设计了一个 `free_all` 函数,而不是要求程序员再去手动实现两步释放操作。回顾一下,`free_all` 函数是这样的:
|
||||
|
||||
```
|
||||
void free_all(HeapStruct* heap_struct) {
|
||||
if (NULL == heap_struct) /* NULL pointer? */
|
||||
return; /* if so, do nothing */
|
||||
|
||||
free(heap_struct->heap_nums); /* first free encapsulated aggregate */
|
||||
free(heap_struct); /* then free containing structure */
|
||||
}
|
||||
```
|
||||
|
||||
检查完参数 `heap_struct` 不是 `NULL` 值后,函数首先释放 `heap_nums` 数组,这步要求 `heap_struct` 指针此时仍然是有效的。先释放 `heap_struct` 的做法是错误的。一旦 `heap_nums` 被释放,`heap_struct` 就可以释放了。如果 `heap_struct` 被释放,但 `heap_nums` 没有被释放,那么数组中的 `float` 元素就会泄漏:仍然分配了字节空间,但无法被访问到——因此一定要记得释放 `heap_nums`。存储泄漏将一直持续,直到 `nestedHeap` 程序退出,系统回收泄漏的字节时为止。
|
||||
|
||||
关于 `free` 库函数的注意事项就是要有顺序。回想一下上面的调用示例:
|
||||
|
||||
```
|
||||
free(heap_struct->heap_nums); /* first free encapsulated aggregate */
|
||||
free(heap_struct); /* then free containing structure */
|
||||
```
|
||||
|
||||
这些调用释放了分配的存储空间——但它们并 _不是_ 将它们的操作参数设置为 `NULL`(`free` 函数会获取地址的副本作为参数;因此,将副本更改为 `NULL` 并不会改变原地址上的参数值)。例如,在成功调用 `free` 之后,指针 `heap_struct` 仍然持有一些堆分配字节的堆地址,但是现在使用这个地址将会产生错误,因为对 `free` 的调用使得系统有权回收然后重用这些分配过的字节。
|
||||
|
||||
使用 `NULL` 参数调用 `free` 没有意义,但也没有什么坏处。而在非 `NULL` 的地址上重复调用 `free` 会导致不确定结果的错误:
|
||||
|
||||
```
|
||||
free(heap_struct); /* 1st call: ok */
|
||||
free(heap_struct); /* 2nd call: ERROR */
|
||||
```
|
||||
|
||||
### 内存泄漏和堆碎片化
|
||||
|
||||
“内存泄漏”是指动态分配的堆存储变得不再可访问。看一下相关的代码段:
|
||||
|
||||
```
|
||||
float* nums = malloc(sizeof(float) * 10); /* 10 floats */
|
||||
nums[0] = 3.14f; /* and so on */
|
||||
nums = malloc(sizeof(float) * 25); /* 25 new floats */
|
||||
```
|
||||
|
||||
假如第一个 `malloc` 成功,第二个 `malloc` 会再将 `nums` 指针重置为 `NULL`(分配失败情况下)或是新分配的 25 个 `float` 中第一个的地址。最初分配的 10 个 `float` 元素的堆存储仍然处于被分配状态,但此时已无法再对其访问,因为 `nums` 指针要么指向别处,要么是 `NULL`。结果就是造成了 40 个字节(`sizeof(float) * 10`)的泄漏。
|
||||
|
||||
在第二次调用 `malloc` 之前,应该释放最初分配的存储空间:
|
||||
|
||||
```
|
||||
float* nums = malloc(sizeof(float) * 10); /* 10 floats */
|
||||
nums[0] = 3.14f; /* and so on */
|
||||
free(nums); /** good **/
|
||||
nums = malloc(sizeof(float) * 25); /* no leakage */
|
||||
```
|
||||
|
||||
即使没有泄漏,堆也会随着时间的推移而碎片化,需要对系统进行碎片整理。例如,假设两个最大的堆块当前的大小分别为 200MB 和 100MB。然而,这两个堆块并不连续,进程 `P` 此时又需要分配 250MB 的连续堆存储。在进行分配之前,系统可能要对堆进行 _碎片整理_ 以给 `P` 提供 250MB 连续存储空间。碎片整理很复杂,因此也很耗时。
|
||||
|
||||
内存泄漏会创建处于已分配状态但不可访问的堆块,从而会加速碎片化。因此,释放不再需要的堆存储是程序员帮助减少碎片整理需求的一种方式。
|
||||
|
||||
### 诊断内存泄漏的工具
|
||||
|
||||
有很多工具可用于分析内存效率和安全性,其中我最喜欢的是 [valgrind][11]。为了说明该工具如何处理内存泄漏,这里给出 `leaky` 示例程序:
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int* get_ints(unsigned n) {
|
||||
int* ptr = malloc(n * sizeof(int));
|
||||
if (ptr != NULL) {
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++) ptr[i] = i + 1;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void print_ints(int* ptr, unsigned n) {
|
||||
unsigned i;
|
||||
for (i = 0; i < n; i++) printf("%3i\n", ptr[i]);
|
||||
}
|
||||
|
||||
int main() {
|
||||
const unsigned n = 32;
|
||||
int* arr = get_ints(n);
|
||||
if (arr != NULL) print_ints(arr, n);
|
||||
|
||||
/** heap storage not yet freed... **/
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
`main` 函数调用了 `get_ints` 函数,后者会试着从堆中 `malloc` 32 个 4 字节的 `int`,然后初始化动态数组(如果 `malloc` 成功)。初始化成功后,`main` 函数会调用 `print_ints`函数。程序中并没有调用 `free` 来对应 `malloc` 操作;因此,内存泄漏了。
|
||||
|
||||
如果安装了 `valgrind` 工具箱,下面的命令会检查 `leaky` 程序是否存在内存泄漏(`%` 是命令行提示符):
|
||||
|
||||
```
|
||||
% valgrind --leak-check=full ./leaky
|
||||
```
|
||||
|
||||
绝大部分输出都在下面给出了。左边的数字 207683 是正在执行的 `leaky` 程序的进程标识符。这份报告给出了泄漏发生位置的详细信息,本例中位置是在 `main` 函数所调用的 `get_ints` 函数中对 `malloc` 的调用处。
|
||||
|
||||
```
|
||||
==207683== HEAP SUMMARY:
|
||||
==207683== in use at exit: 128 bytes in 1 blocks
|
||||
==207683== total heap usage: 2 allocs, 1 frees, 1,152 bytes allocated
|
||||
==207683==
|
||||
==207683== 128 bytes in 1 blocks are definitely lost in loss record 1 of 1
|
||||
==207683== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
|
||||
==207683== by 0x109186: get_ints (in /home/marty/gc/leaky)
|
||||
==207683== by 0x109236: main (in /home/marty/gc/leaky)
|
||||
==207683==
|
||||
==207683== LEAK SUMMARY:
|
||||
==207683== definitely lost: 128 bytes in 1 blocks
|
||||
==207683== indirectly lost: 0 bytes in 0 blocks
|
||||
==207683== possibly lost: 0 bytes in 0 blocks
|
||||
==207683== still reachable: 0 bytes in 0 blocks
|
||||
==207683== suppressed: 0 bytes in 0 blocks
|
||||
```
|
||||
|
||||
如果把 `main` 函数改成在对 `print_ints` 的调用之后,再加上一个对 `free` 的调用,`valgrind` 就会对 `leaky` 程序给出一个干净的内存健康清单:
|
||||
|
||||
```
|
||||
==218462== All heap blocks were freed -- no leaks are possible
|
||||
```
|
||||
|
||||
### 静态区存储
|
||||
|
||||
在正统的 C 语言中,函数必须在所有块之外定义。这是一些 C 编译器支持的特性,杜绝了在另一个函数体内定义一个函数的可能。我举的例子都是在所有块之外定义的函数。这样的函数要么是 `static` ,即静态的,要么是 `extern`,即外部的,其中 `extern` 是默认值。
|
||||
|
||||
C 语言中,以 `static` 或 `extern` 修饰的函数和变量驻留在内存中所谓的 **静态区** 中,因为在程序执行期间该区域大小是固定不变的。这两个存储类型的语法非常复杂,我们应该回顾一下。在回顾之后,会有一个完整的代码示例来生动展示语法细节。在所有块之外定义的函数或变量默认为 `extern`;因此,函数和变量要想存储类型为 `static` ,必须显式指定:
|
||||
|
||||
```
|
||||
/** file1.c: outside all blocks, five definitions **/
|
||||
int foo(int n) { return n * 2; } /* extern by default */
|
||||
static int bar(int n) { return n; } /* static */
|
||||
extern int baz(int n) { return -n; } /* explicitly extern */
|
||||
|
||||
int num1; /* extern */
|
||||
static int num2; /* static */
|
||||
```
|
||||
|
||||
`extern` 和 `static` 的区别在于作用域:`extern` 修饰的函数或变量可以实现跨文件可见(需要声明)。相比之下,`static` 修饰的函数仅在 _定义_ 该函数的文件中可见,而 `static` 修饰的变量仅在 _定义_ 该变量的文件(或文件中的块)中可见:
|
||||
|
||||
```
|
||||
static int n1; /* scope is the file */
|
||||
void func() {
|
||||
static int n2; /* scope is func's body */
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
如果在所有块之外定义了 `static` 变量,例如上面的 `n1`,该变量的作用域就是定义变量的文件。无论在何处定义 `static` 变量,变量的存储都在内存的静态区中。
|
||||
|
||||
`extern` 函数或变量在给定文件中的所有块之外定义,但这样定义的函数或变量也可以在其他文件中声明。典型的做法是在头文件中 _声明_ 这样的函数或变量,只要需要就可以包含进来。下面这些简短的例子阐述了这些棘手的问题。
|
||||
|
||||
假设 `extern` 函数 `foo` 在 `file1.c` 中 _定义_,有无关键字 `extern` 效果都一样:
|
||||
|
||||
```
|
||||
/** file1.c **/
|
||||
int foo(int n) { return n * 2; } /* definition has a body {...} */
|
||||
```
|
||||
|
||||
必须在其他文件(或其中的块)中使用显式的 `extern` _声明_ 此函数才能使其可见。以下是使 `extern` 函数 `foo` 在文件 `file2.c` 中可见的声明语句:
|
||||
|
||||
```
|
||||
/** file2.c: make function foo visible here **/
|
||||
extern int foo(int); /* declaration (no body) */
|
||||
```
|
||||
|
||||
回想一下,函数声明没有用大括号括起来的主体,而函数定义会有这样的主体。
|
||||
|
||||
为了便于查看,函数和变量声明通常会放在头文件中。准备好需要声明的源代码文件,然后就可以 `#include` 相关的头文件。下一节中的 `staticProg` 程序演示了这种方法。
|
||||
|
||||
至于 `extern` 的变量,规则就变得更棘手了(很抱歉增加了难度!)。任何 `extern` 的对象——无论函数或变量——必须 _定义_ 在所有块之外。此外,在所有块之外定义的变量默认为 `extern`:
|
||||
|
||||
```
|
||||
/** outside all blocks **/
|
||||
int n; /* defaults to extern */
|
||||
```
|
||||
|
||||
但是,只有在变量的 _定义_ 中显式初始化变量时,`extern` 才能在变量的 _定义_ 中显式修饰(LCTT 译注:换言之,如果下列代码中的 `int n1;` 行前加上 `extern`,该行就由 _定义_ 变成了 _声明_):
|
||||
|
||||
```
|
||||
/** file1.c: outside all blocks **/
|
||||
int n1; /* defaults to extern, initialized by compiler to zero */
|
||||
extern int n2 = -1; /* ok, initialized explicitly */
|
||||
int n3 = 9876; /* ok, extern by default and initialized explicitly */
|
||||
```
|
||||
|
||||
要使在 `file1.c` 中定义为 `extern` 的变量在另一个文件(例如 `file2.c`)中可见,该变量必须在 `file2.c` 中显式 _声明_ 为 `extern` 并且不能初始化(初始化会将声明转换为定义):
|
||||
|
||||
```
|
||||
/** file2.c **/
|
||||
extern int n1; /* declaration of n1 defined in file1.c */
|
||||
```
|
||||
|
||||
为了避免与 `extern` 变量混淆,经验是在 _声明_ 中显式使用 `extern`(必须),但不要在 _定义_ 中使用(非必须且棘手)。对于函数,`extern` 在定义中是可选使用的,但在声明中是必须使用的。下一节中的 `staticProg` 示例会把这些点整合到一个完整的程序中。
|
||||
|
||||
### staticProg 示例
|
||||
|
||||
`staticProg` 程序由三个文件组成:两个 C 语言源文件(`static1.c` 和 `static2.c`)以及一个头文件(`static.h`),头文件中包含两个声明:
|
||||
|
||||
```
|
||||
/** header file static.h **/
|
||||
#define NumCount 100 /* macro */
|
||||
extern int global_nums[NumCount]; /* array declaration */
|
||||
extern void fill_array(); /* function declaration */
|
||||
```
|
||||
|
||||
两个声明中的 `extern`,一个用于数组,另一个用于函数,强调对象在别处(“外部”)_定义_:数组 `global_nums` 在文件 `static1.c` 中定义(没有显式的 `extern`),函数 `fill_array` 在文件 `static2.c` 中定义(也没有显式的 `extern`)。每个源文件都包含了头文件 `static.h`。`static1.c` 文件定义了两个驻留在内存静态区域中的数组(`global_nums` 和 `more_nums`)。第二个数组有 `static` 修饰,这将其作用域限制为定义数组的文件 (`static1.c`)。如前所述, `extern` 修饰的 `global_nums` 则可以实现在多个文件中可见。
|
||||
|
||||
```
|
||||
/** static1.c **/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "static.h" /* declarations */
|
||||
|
||||
int global_nums[NumCount]; /* definition: extern (global) aggregate */
|
||||
static int more_nums[NumCount]; /* definition: scope limited to this file */
|
||||
|
||||
int main() {
|
||||
fill_array(); /** defined in file static2.c **/
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < NumCount; i++)
|
||||
more_nums[i] = i * -1;
|
||||
|
||||
/* confirm initialization worked */
|
||||
for (i = 0; i < NumCount; i += 10)
|
||||
printf("%4i\t%4i\n", global_nums[i], more_nums[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
下面的 `static2.c` 文件中定义了 `fill_array` 函数,该函数由 `main`(在 `static1.c` 文件中)调用;`fill_array` 函数会给名为 `global_nums` 的 `extern` 数组中的元素赋值,该数组在文件 `static1.c` 中定义。使用两个文件的唯一目的是凸显 `extern` 变量或函数能够跨文件可见。
|
||||
|
||||
```
|
||||
/** static2.c **/
|
||||
#include "static.h" /** declarations **/
|
||||
|
||||
void fill_array() { /** definition **/
|
||||
unsigned i;
|
||||
for (i = 0; i < NumCount; i++) global_nums[i] = i + 2;
|
||||
}
|
||||
```
|
||||
|
||||
`staticProg` 程序可以用如下编译:
|
||||
|
||||
```
|
||||
% gcc -o staticProg static1.c static2.c
|
||||
```
|
||||
|
||||
### 从汇编语言看更多细节
|
||||
|
||||
现代 C 编译器能够处理 C 和汇编语言的任意组合。编译 C 源文件时,编译器首先将 C 代码翻译成汇编语言。这是对从上文 `static1.c` 文件生成的汇编语言进行保存的命令:
|
||||
|
||||
```
|
||||
% gcc -S static1.c
|
||||
```
|
||||
|
||||
生成的文件就是 `static1.s`。这是文件顶部的一段代码,额外添加了行号以提高可读性:
|
||||
|
||||
```
|
||||
.file "static1.c" ## line 1
|
||||
.text ## line 2
|
||||
.comm global_nums,400,32 ## line 3
|
||||
.local more_nums ## line 4
|
||||
.comm more_nums,400,32 ## line 5
|
||||
.section .rodata ## line 6
|
||||
.LC0: ## line 7
|
||||
.string "%4i\t%4i\n" ## line 8
|
||||
.text ## line 9
|
||||
.globl main ## line 10
|
||||
.type main, @function ## line 11
|
||||
main: ## line 12
|
||||
...
|
||||
```
|
||||
|
||||
诸如 `.file`(第 1 行)之类的汇编语言指令以句点开头。顾名思义,指令会指导汇编程序将汇编语言翻译成机器代码。`.rodata` 指令(第 6 行)表示后面是只读对象,包括字符串常量 `"%4i\t%4i\n"`(第 8 行),`main` 函数(第 12 行)会使用此字符串常量来实现格式化输出。作为标签引入(通过末尾的冒号实现)的 `main` 函数(第 12 行),同样也是只读的。
|
||||
|
||||
在汇编语言中,标签就是地址。标签 `main:`(第 12 行)标记了 `main` 函数代码开始的地址,标签 `.LC0:`(第 7 行)标记了格式化字符串开头所在的地址。
|
||||
|
||||
`global_nums`(第 3 行)和 `more_nums`(第 4 行)数组的定义包含了两个数字:400 是每个数组中的总字节数,32 是每个数组(含 100 个 `int` 元素)中每个元素的比特数。(第 5 行中的 `.comm` 指令表示 `common name`,可以忽略。)
|
||||
|
||||
两个数组定义的不同之处在于 `more_nums` 被标记为 `.local`(第 4 行),这意味着其作用域仅限于其所在文件 `static1.s`。相比之下,`global_nums` 数组就能在多个文件中实现可见,包括由 `static1.c` 和 `static2.c` 文件翻译成的汇编文件。
|
||||
|
||||
最后,`.text` 指令在汇编代码段中出现了两次(第 2 行和第 9 行)。术语“text”表示“只读”,但也会涵盖一些读/写变量,例如两个数组中的元素。尽管本文展示的汇编语言是针对 Intel 架构的,但 Arm6 汇编也非常相似。对于这两种架构,`.text` 区域中的变量(本例中为两个数组中的元素)会自动初始化为零。
|
||||
|
||||
### 总结
|
||||
|
||||
C 语言中的内存高效和内存安全编程准则很容易说明,但可能会很难遵循,尤其是在调用设计不佳的库的时候。准则如下:
|
||||
|
||||
* 尽可能使用栈存储,进而鼓励编译器将通用寄存器用作暂存器,实现优化。栈存储代表了高效的内存使用并促进了代码的整洁和模块化。永远不要返回指向基于栈的存储的指针。
|
||||
* 小心使用堆存储。C(和 C++)中的重难点是确保动态分配的存储尽快解除分配。良好的编程习惯和工具(如 `valgrind`)有助于攻关这些重难点。优先选用自身提供释放函数的库,例如 `nestedHeap` 代码示例中的 `free_all` 释放函数。
|
||||
* 谨慎使用静态存储,因为这种存储会自始至终地影响进程的内存占用。特别是尽量避免使用 `extern` 和 `static` 数组。
|
||||
|
||||
本文 C 语言代码示例可在我的网站(<https://condor.depaul.edu/mkalin>)上找到。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/memory-programming-c
|
||||
|
||||
作者:[Marty Kalin][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[unigeorge](https://github.com/unigeorge)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mkalindepauledu
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.)
|
||||
[2]: http://www.opengroup.org/onlinepubs/009695399/functions/fopen.html
|
||||
[3]: http://www.opengroup.org/onlinepubs/009695399/functions/fclose.html
|
||||
[4]: http://www.opengroup.org/onlinepubs/009695399/functions/fread.html
|
||||
[5]: http://www.opengroup.org/onlinepubs/009695399/functions/fwrite.html
|
||||
[6]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
|
||||
[7]: http://www.opengroup.org/onlinepubs/009695399/functions/puts.html
|
||||
[8]: http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html
|
||||
[9]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html
|
||||
[10]: http://www.opengroup.org/onlinepubs/009695399/functions/free.html
|
||||
[11]: https://www.valgrind.org/
|
110
published/20210818 below- a time traveling resource monitor.md
Normal file
110
published/20210818 below- a time traveling resource monitor.md
Normal file
@ -0,0 +1,110 @@
|
||||
[#]: subject: "below: a time traveling resource monitor"
|
||||
[#]: via: "https://fedoramagazine.org/below-a-time-traveling-resource-monitor/"
|
||||
[#]: author: "Daniel Xu https://fedoramagazine.org/author/dxuu/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13854-1.html"
|
||||
|
||||
Below:一个时间旅行的资源监控器
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/06/093522hdsb82nm1cb4b4b6.jpg)
|
||||
|
||||
在这篇文章中,我们将介绍 `below`:一个用于现代 Linux 系统的 Apache 2.0 许可的资源监视器。`below` 可以让你重放以前记录的数据。
|
||||
|
||||
![][1]
|
||||
|
||||
### 背景
|
||||
|
||||
内核的主要职责之一是调度对资源的访问。有时这可能意味着分配物理内存,使多个进程可以共享同一主机。其他时候,它可能意味着确保 CPU 时间的公平分配。在这些场景里,内核提供了机制,而将策略留给了“别人”。近来,这个“别人”通常是 systemd 或 dockerd 这样的运行时。运行时接受来自调度器或最终用户的输入(类似于运行什么和如何运行)并在内核上转动正确的旋钮和拉动正确的杠杆,从而使工作负载能够*好好*工作。
|
||||
|
||||
在一个完美的世界里,故事就到此结束了。然而,现实情况是,资源管理是一个复杂的、相当不透明的技术混合体,在几十年里计算技术不断发展。尽管其中一些技术有各种缺陷和死角,但最终的结果是,容器运作得比较好。虽然用户通常不需要关心这些细节,但对于基础设施运营商来说,对他们的技术架构拥有可见性是至关重要的。可见性和可调试性对于检测和调查错误的配置、问题和系统性故障至关重要。
|
||||
|
||||
让事情变得更加复杂的是,资源中断往往难以重现。经常需要花费数周时间等待一个问题重新出现,以便调查其根本原因。规模的扩大进一步加剧了这个问题:我们不能在*每台*主机上运行一个自定义脚本,希望在错误再次发生时记录下关键状态的片段。因此,需要更复杂的工具。这就出现了 `below`。
|
||||
|
||||
### 动机
|
||||
|
||||
历史上,Facebook 一直是 [atop][5] 的忠实用户。`atop` 是一个用于 Linux 的性能监视器,能够报告所有进程的活动以及各种系统级活动。与 `htop` 等工具相比,`atop` 最引人注目的功能之一是能够作为一个守护程序记录历史数据。这听起来是一个简单的功能,但在实践中,这使得调试无数的生产问题成为可能。有了足够长的数据保留,就有可能在时间上回溯,查看在问题或故障发生之前、期间和之后的主机状态。
|
||||
|
||||
不幸的是,随着时间的推移,人们发现`atop` 有某些不足之处。首先,<ruby>[控制组][6]<rt>cgroup</rt></ruby> 已经成为控制和监视 Linux 机器上资源的实际方式。`atop` 仍然缺乏对这一基本构建模块的支持。第二,`atop` 用自定义的 delta 压缩方法在磁盘上存储数据。这在正常情况下运行良好,但在沉重的资源压力下,主机很可能会丢失数据点。由于使用了 delta 压缩,在数据最重要的时间段内,数据可能会大面积丢失。第三,用户体验有一个陡峭的学习曲线。我们经常听到 `atop` 的资深用户说,他们喜欢密集的布局和众多的键盘绑定。然而,这也是一把双刃剑。当一个刚进入这个领域的人想要调试一个生产问题时,他们现在要同时解决两个问题:手头的问题和如何使用 `atop`。
|
||||
|
||||
`below` 是由 Facebook 的资源控制团队为其设计和开发的,并得到了 `atop` 生产环境用户的支持。顾名思义,资源控制团队负责的是规模化的资源管理。该团队由内核开发人员、容器运行时开发人员和硬件人员组成。认识到下一代系统监控器的机会,我们在设计 `below` 时考虑到以下几点:
|
||||
|
||||
* 易用性:`below` 必须既能为新用户提供直观的体验,又能为日常用户提供强大的功能。
|
||||
*有意义的统计数据:`below` 显示准确和有用的统计数据。即便可以,但我们尽量避免收集和倾倒统计数字。
|
||||
* 灵活性:当默认设置不合适时,我们允许用户自定义他们的体验。例如包括可配置的键绑定、可配置的默认视图,以及脚本界面(默认为终端用户接口)。
|
||||
|
||||
### 安装
|
||||
|
||||
安装该软件包:
|
||||
|
||||
```
|
||||
# dnf install -y below
|
||||
```
|
||||
|
||||
打开记录守护进程:
|
||||
|
||||
```
|
||||
# systemctl enable --now below
|
||||
```
|
||||
|
||||
### 快速介绍
|
||||
|
||||
`below` 最常用的模式是重放模式。顾名思义,重放模式是重放以前记录的数据。假设你已经启动了记录守护程序,那么通过运行以下程序启动一个会话:
|
||||
|
||||
```
|
||||
$ below replay --time "5 minutes ago"
|
||||
```
|
||||
|
||||
然后你会看到控制组视图:
|
||||
|
||||
![][2]
|
||||
|
||||
如果你不知道该怎么操作,或者忘记了一个键位,按 `?` 可以进入帮助菜单。
|
||||
|
||||
屏幕的最上方是状态栏。状态栏显示关于当前样本的信息。你可以通过按 `t` 和 `T` 分别向前和向后移动样本。中间的部分是系统概览。系统概览包含了关于整个系统的统计数据,一般来说,这些数据总是很有用的。第三部分也是最下面的部分是多用途视图。上面的图片显示了控制组视图。此外,还有进程和系统视图,分别通过按 `p` 和` s` 来访问。
|
||||
|
||||
按 `↑` 和 `↓` 来移动列表选择。按回车键来折叠和展开控制组。假设你发现了一个感兴趣的控制组,你想看看它里面有哪些进程在运行。要放大进程视图,选择控制组并按 `z`:
|
||||
|
||||
![][3]
|
||||
|
||||
再按 `z` 返回到控制组视图。这个视图有时会有点长。如果你对你要找的东西有一个模糊的概念,你可以通过按 `/` 并输入一个过滤器来过滤控制组名称。
|
||||
|
||||
![][4]
|
||||
|
||||
在这一点上,你可能已经注意到了一个我们还没有探索过的标签系统。要在标签中向前和向后循环,可以分别按 `Tab` 和 `Shift` + `Tab`。我们把这个问题留给读者去做练习。
|
||||
|
||||
### 其他功能
|
||||
|
||||
在底层,`below` 有一个强大的设计和架构。Facebook 正在不断升级到更新的内核,所以我们从不假设数据源是可用的。这种默契的假设使得内核和 `below `版本之间能够完全向前和向后兼容。此外,每个数据点都用 zstd 压缩并完整地存储。这解决了我们看到的 `atop` 在大规模时的 delta 压缩问题。根据我们的测试,我们的每个样本压缩可以达到平均 5 倍的压缩率。
|
||||
|
||||
`below` 也使用 [eBPF][8] 来收集关于短暂进程(生存时间短于数据收集间隔的进程)的信息。相比之下,`atop` 使用 BSD 进程核算来实现这一功能,这是一个已知缓慢且容易发生优先级转换的内核接口。
|
||||
|
||||
对于用户来说,`below` 还支持实时模式和一个转储接口。实时模式将记录守护程序和 TUI 会话合并到一个进程中。这对于浏览系统状态是很方便的,不需要为数据存储投入长期运行的守护程序或磁盘空间。转储接口是一个可编写脚本的接口,用于所有的 `below` 数据存储。转储既强大又灵活,详细的数据以 CSV、JSON 和人类可读格式提供。
|
||||
|
||||
### 总结
|
||||
|
||||
`below` 是一个 Apache 2.0 许可的开源项目,我们(`below` 的开发者)认为它比资源监控领域的现有工具具有引人注目的优势。我们已经花了大量的精力来准备 `below`,以提供开源使用,所以我们希望读者和社区有机会尝试 `below`,并报告错误和功能要求。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/below-a-time-traveling-resource-monitor/
|
||||
|
||||
作者:[Daniel Xu][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/dxuu/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/08/below_resource_monitor-816x345.jpg
|
||||
[2]: https://fedoramagazine.org/wp-content/uploads/2021/08/image-1024x800.png
|
||||
[3]: https://fedoramagazine.org/wp-content/uploads/2021/08/image-1-1024x800.png
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2021/08/image-2-1024x800.png
|
||||
[5]: <https://www.atoptool.nl/>
|
||||
[6]: <https://en.wikipedia.org/wiki/Cgroups>
|
||||
[7]: <https://ebpf.io/>
|
@ -3,25 +3,26 @@
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (unigeorge)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13832-1.html)
|
||||
|
||||
什么是配置文件?
|
||||
浅谈配置文件格式
|
||||
======
|
||||
|
||||
流行的配置文件格式有若干种,每种都有其独特优势。从中找到最适合你的格式吧!
|
||||
![Computer screen with files or windows open][1]
|
||||
> 流行的配置文件格式有若干种,每种都有其自身优势。从中找到最适合你的格式吧!
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/29/134955py5ypl58dgplyx4x.jpg)
|
||||
|
||||
计算机上有数以千计的配置文件。你可能永远不会直接与其中的大部分文件打交道,但它们确实散落在你的 `/etc` 以及 `~/.config`、`~/.local`、`/usr` 文件夹中。还有一些可能在 `/var`,甚至 `/opt` 文件夹中。如果无意中打开过或更改过它们,你就可能会有疑问:为什么有些配置文件看起来是某一种格式,而另一些则是看起来完全不同的格式?
|
||||
|
||||
存储配置是一项很灵活的任务,因为只要开发人员知道他们的代码如何将数据存入文件,他们就可以轻松编写代码来根据需要提取数据。然而,科技行业非常青睐有详细文档的标准化事物,因此多年来出现了几种比较普遍的格式用来简化配置任务。
|
||||
存储配置是一项很灵活的任务,因为只要开发人员知道他们的代码是如何将数据存入文件的,他们就可以轻松编写代码来根据需要提取数据。然而,科技行业非常青睐有详细文档的标准化事物,因此多年来出现了几种比较普遍的格式用来简化配置任务。
|
||||
|
||||
### 为什么我们需要配置文件
|
||||
|
||||
配置文件对于现代计算来说很重要。它们使你能够自定义与应用程序交互的方式,或自定义应用程序与系统内其他程序的交互方式。有了配置文件,每当你启动某个应用程序时,它都会有“记忆”,记录了你喜欢如何去使用该程序。
|
||||
|
||||
配置文件的结构可以很简单,而且通常确实也很简单。例如,如果你要编写一个应用程序,程序唯一需要知道的是其用户的偏好名称,那么它的唯一配置文件就可以只包含一个词:用户名。就像下面这样:
|
||||
配置文件的结构可以很简单,而且通常确实也很简单。例如,如果你要编写一个应用程序,程序唯一需要知道的是其用户的偏好名字,那么它的唯一配置文件就可以只包含一个词:用户名。就像下面这样:
|
||||
|
||||
```
|
||||
Tux
|
||||
@ -34,7 +35,7 @@ NAME='Tux'
|
||||
SPECIES='Penguin'
|
||||
```
|
||||
|
||||
即使没有编程经验,你也可以想象出代码如何解析这些数据。这里有两个简单的例子,一个使用 [`awk` 命令][2],另一个使用 [grep 命令][3]。两个例子都是只关注包含 `NAME`“键”的行,并返回出现在等号 (`=`) 之后的“值”:
|
||||
即使没有编程经验,你也可以想象出代码如何解析这些数据。这里有两个简单的例子,一个使用 [awk 命令][2],另一个使用 [grep 命令][3]。两个例子都是只关注包含 `NAME` “键”的行,并返回出现在等号 (`=`) 之后的“值”:
|
||||
|
||||
```
|
||||
$ awk -F'=' '/NAME/ { print $2; }' myconfig.ini
|
||||
@ -47,7 +48,7 @@ $ grep NAME fake.txt | cut -d'=' -f2
|
||||
|
||||
### 选择格式
|
||||
|
||||
为了保证普遍有效性,配置文件最重要的一点是它们是一致的和可预测的。你绝对不会想做这样的事:以保存用户首选项的名义,将信息随意存储到文件中,然后就得花好几天时间来编写代码,以对整个文件中的随机信息实现读取操作。
|
||||
为了保证普遍有效性,配置文件最重要的一点是它们是一致的和可预测的。你绝对不会想做这样的事:以保存用户首选项的名义,将信息随意存储到文件中,然后花好几天时间逆向工程,来找到最终出现在文件中的随机信息。
|
||||
|
||||
流行的配置文件格式有若干种,每种格式都有自己的优势。
|
||||
|
||||
@ -64,7 +65,7 @@ enabled=1
|
||||
|
||||
这种简单的配置风格很直观,只要你别选择使用糟糕的键名(比如用 `unampref` 这样的神秘键名来代替 `name`)就好。这些键值对很容易解析和编辑。
|
||||
|
||||
除了键和值之外,INI 格式还可以分 <ruby>节<rt>section</rt></ruby>。在下列示例代码中,`[example]` 和 `[demo]` 就是配置文件中的两节:
|
||||
除了键和值之外,INI 格式还可以分 <ruby>节<rt>section</rt></ruby>。在下列示例代码中,`[example]` 和 `[demo]` 就是配置文件中的两个节:
|
||||
|
||||
```
|
||||
[example]
|
||||
@ -77,14 +78,14 @@ name=Beastie
|
||||
fullscreen=1
|
||||
```
|
||||
|
||||
这几个配置语句解析起来有点复杂,因为有 _两个_ `name` 键。想象一下,一个粗心的程序员在这个配置文件中查询 `name`,结果总是返回 `Beastie`,因为这是文件中对 name 的最后一个定义值。在解析这样的文件时,开发人员必须加倍小心地在各节中搜索键,这可能会很棘手,具体取决于用来解析该文件的语言。然而,它仍然是一种很流行的格式,大多数语言都会有一个现成的库来帮助程序员解析 INI 文件。
|
||||
这几个配置语句解析起来有点复杂,因为有两个 `name` 键。想象一下,一个粗心的程序员在这个配置文件中查询 `name`,结果总是返回 `Beastie`,因为这是文件中对 `name` 的最后一个定义值。在解析这样的文件时,开发人员必须加倍小心地在各节中搜索键,这可能会很棘手,具体取决于用来解析该文件的语言。然而,它仍然是一种很流行的格式,大多数语言都会有一个现成的库来帮助程序员解析 INI 文件。
|
||||
|
||||
#### YAML
|
||||
|
||||
[YAML 文件][4] 是结构化列表,可以包含值或者键值对:
|
||||
|
||||
```
|
||||
\---
|
||||
---
|
||||
Example:
|
||||
Name: 'Tux'
|
||||
Style:
|
||||
@ -93,13 +94,13 @@ Example:
|
||||
Enabled: 1
|
||||
```
|
||||
|
||||
YAML 格式很流行,部分原因是它看起来很整洁。数据要放置到相对其上层数据的特定位置,除此之外没有太多其他语法。然而,对于某些人来说的特色,在其他人眼中可能就是一个 bug。许多开发人员不愿使用 YAML,正是因为它很看重本质上 _不存在_ 的东西。如果你在 YAML 中缩进错误,YAML 解析器可能会将你的文件视为无效文件,即使不视为无效,返回的数据也可能是错误的。
|
||||
YAML 格式很流行,部分原因是它看起来很整洁。数据要放置到相对其上层数据的特定位置,除此之外没有太多其他语法。然而,对于某些人来说的这种特色,在其他人眼中可能就是一个问题。许多开发人员不愿使用 YAML,正是因为它很看重本质上 _不存在_ 的东西。如果你在 YAML 中缩进错误,YAML 解析器可能会将你的文件视为无效文件,即使不视为无效,返回的数据也可能是错误的。
|
||||
|
||||
大多数语言都有 YAML 解析器,并且有很好的开源 YAML linters(验证语法的应用程序)来帮你确保 YAML 文件的完整性。
|
||||
|
||||
#### JSON
|
||||
|
||||
JSON 文件在技术上来说是 YAML 的子类,因此其数据结构是相同的,尽管其语法完全不同:
|
||||
JSON 文件在技术上来说是 YAML 的子集,因此其数据结构是相同的,尽管其语法完全不同:
|
||||
|
||||
```
|
||||
{
|
||||
@ -116,7 +117,7 @@ JSON 文件在技术上来说是 YAML 的子类,因此其数据结构是相同
|
||||
}
|
||||
```
|
||||
|
||||
JSON 在 JavaScript 程序员中很流行,这并不奇怪,因为 JSON 全称为 JavaScript Object Notation 即 JavaScript 对象符号。由于与 Web 开发密切相关,JSON 是 Web API 的常见输出格式。大多数编程语言都有解析 JSON 的库。
|
||||
JSON 在 JavaScript 程序员中很流行,这并不奇怪,因为 JSON 全称为<ruby>JavaScript 对象符号<rt>JavaScript Object Notation</rt></ruby>。由于与 Web 开发密切相关,JSON 是 Web API 的常见输出格式。大多数编程语言都有解析 JSON 的库。
|
||||
|
||||
#### XML
|
||||
|
||||
@ -158,7 +159,7 @@ via: https://opensource.com/article/21/6/what-config-files
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[unigeorge](https://github.com/unigeorge)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,13 +3,15 @@
|
||||
[#]: author: "John Paul https://itsfoss.com/author/john/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13831-1.html"
|
||||
|
||||
不是 Windows,也不是 Linux,Shrine 才是 “神之操作系统”
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/28/154516dcc5u1a50zfn4abw.jpg)
|
||||
|
||||
在生活中,我们都曾使用过多种操作系统。有些好,有些坏。但你能说你使用过由“神”设计的操作系统吗?今天,我想向你介绍 Shrine(圣殿)。
|
||||
|
||||
### 什么是 Shrine?
|
||||
@ -18,21 +20,21 @@
|
||||
|
||||
从介绍里,你可能想知道这到底是怎么回事。嗯,这一切都始于一个叫 Terry Davis 的人。在我们进一步介绍之前,我最好提醒你,Terry 在生前患有精神分裂症,而且经常不吃药。正因为如此,他在生活中说过或做过一些不被社会接受的事情。
|
||||
|
||||
总之,让我们回到故事的主线。在 21 世纪初,Terry 发布了一个简单的操作系统。多年来,它不停地换了几个名字,有 J Operating System、LoseThos 和 SparrowOS 等等。他最终确定了 [TempleOS][2] 这个名字。他选择这个名字(神庙系统)是因为这个操作系统将成为神的圣殿。因此,神给 Terry 的操作系统规定了以下 [规格][3]:
|
||||
总之,让我们回到故事的主线。在 21 世纪初,Terry 发布了一个简单的操作系统。多年来,它不停地换了几个名字,有 J Operating System、LoseThos 和 SparrowOS 等等。他最终确定了 [TempleOS][2](神庙系统)这个名字。他选择这个名字是因为这个操作系统将成为“神的圣殿”。因此,“神”给 Terry 的操作系统规定了以下 [规格][3]:
|
||||
|
||||
![video](https://youtu.be/LtlyeDAJR7A)
|
||||
|
||||
* 它将有 640×480 的 16 色图形
|
||||
* 它将使用“单声道 8 位带符号的类似 MIDI 的声音采样”
|
||||
* 它将有 640×480 的 16 色图形显示
|
||||
* 它将使用 “单声道 8 位带符号的类似 MIDI 的声音采样”
|
||||
* 它将追随 Commodore 64,即“一个非网络化的简单机器,编程是目标,而不仅仅是达到目的的手段”
|
||||
* 它将只支持一个文件系统(名为 “Red Sea”)。
|
||||
* 它将被限制在 10 万行代码内,以使它 “整体易于学习”。
|
||||
* “只支持 Ring-0 级,一切都在内核模式下运行,包括用户应用程序
|
||||
* 它将只支持一个文件系统(名为 “Red Sea”)
|
||||
* 它将被限制在 10 万行代码内,以使它 “整体易于学习”
|
||||
* “只支持 Ring-0 级,一切都在内核模式下运行,包括用户应用程序”
|
||||
* 字体将被限制为 “一种 8×8 等宽字体”
|
||||
* “对一切都可以完全访问。所有的内存、I/O 端口、指令和类似的东西都绝无限制。所有的函数、变量和类成员都是可访问的”
|
||||
* 它将只支持一个平台,即 64 位 PC
|
||||
|
||||
Terry 用一种他称之为 HolyC(神圣 C 语言)的编程语言编写了这个操作系统。TechRepublic 称其为一种 “C++ 的修改版(‘比 C 多,比 C++ 少’)”。如果你有兴趣了解 HolyC,我推荐,[这篇文章][4] 和 [RosettaCode][5] 上的 HolyC 条目。
|
||||
Terry 用一种他称之为 HolyC(神圣 C 语言)的编程语言编写了这个操作系统。TechRepublic 称其为一种 “C++ 的修改版(‘比 C 多,比 C++ 少’)”。如果你有兴趣了解 HolyC,我推荐 [这篇文章][4] 和 [RosettaCode][5] 上的 HolyC 条目。
|
||||
|
||||
2013 年,Terry 在他的网站上宣布,TempleOS 已经完成。不幸的是,几年后的 2018 年 8 月,Terry 被火车撞死了。当时他无家可归。多年来,许多人通过他在该操作系统上的工作关注着他。大多数人对他在如此小的体积中编写操作系统的能力印象深刻。
|
||||
|
||||
@ -45,6 +47,8 @@ Terry 用一种他称之为 HolyC(神圣 C 语言)的编程语言编写了
|
||||
|
||||
minexew 正计划在未来增加更多的功能,但还没有宣布具体会包括什么。他有计划为 Linux 制作一个完整的 TempleOS 环境。
|
||||
|
||||
![video](https://youtu.be/UCgoxQCf5Jg)
|
||||
|
||||
### 体验
|
||||
|
||||
让 Shrine 在虚拟机中运行是相当容易的。你所需要做的就是安装你选择的虚拟化软件。(我的是 VirtualBox)当你为 Shrine 创建一个虚拟机时,确保它是 64 位的,并且至少有 512MB 的内存。
|
||||
@ -62,7 +66,7 @@ via: https://itsfoss.com/shrine-os/
|
||||
作者:[John Paul][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,135 @@
|
||||
[#]: subject: "Use Vagrant to test your scripts on different operating systems"
|
||||
[#]: via: "https://opensource.com/article/21/9/test-vagrant"
|
||||
[#]: author: "Ayush Sharma https://opensource.com/users/ayushsharma"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13829-1.html"
|
||||
|
||||
使用 Vagrant 在不同的操作系统上测试你的脚本
|
||||
======
|
||||
|
||||
> Vagrant 可以帮助你在你的电脑上运行其他操作系统,这意味着你可以构建、测试、疯狂折腾而不毁坏你的系统。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/28/115827gv75kkrhnnhvkhcf.jpg)
|
||||
|
||||
我使用 Vagrant 已经很长时间了。我使用几种 DevOps 工具,把它们全安装在一个系统上会搞得很乱。Vagrant 可以让你在不破坏系统的情况下随意折腾,因为你根本不需要在生产系统上做实验。
|
||||
|
||||
如果你熟悉 [VirtualBox][2] 或 [GNOME Boxes][3],那么学习 Vagrant 很容易。Vagrant 有一个简单而干净的界面用于管理虚拟机。一个名为 `Vagrantfile` 的配置文件,允许你定制你的虚拟机(称为 “Vagrant <ruby>盒子<rt>box</rt></ruby>”)。一个简单的命令行界面让你启动、停止、暂停或销毁你的“盒子”。
|
||||
|
||||
考虑一下这个简单的例子。
|
||||
|
||||
假设你想写 Ansible 或 shell 脚本,在一个新的服务器上安装 Nginx。你不能在你自己的系统上这样做,因为你运行的可能不是你想测试的操作系统,或者没有所有的依赖项。启动新的云服务器进行测试可能会很费时和昂贵。这就是 Vagrant 派上用处的地方。你可以用它来启动一个虚拟机,用你的脚本来<ruby>配备<rt>provision</rt></ruby>它,并证明一切按预期工作。然后,你可以删除这个“盒子”,重新配备它,并重新运行你的脚本来验证它。你可以多次重复这个过程,直到你确信你的脚本在所有条件下都能工作。你可以将你的 Vagrantfile 提交给 Git,以确保你的团队正在测试完全相同的环境(因为他们将使用完全相同的测试机)。不会再有“但它在我的机器上运行良好!”这事了。
|
||||
|
||||
### 开始使用
|
||||
|
||||
首先,[在你的系统上安装 Vagrant][4],然后创建一个新的文件夹进行实验。在这个新文件夹中,创建一个名为 `Vagrantfile` 的新文件,内容如下:
|
||||
|
||||
```
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
config.vm.box = "ubuntu/hirsute64"
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
你也可以运行 `vagrant init ubuntu/hirsute64`,它将为你生成一个新的 Vagrant 文件。现在运行 `vagrant up`。这个命令将从 Vagrant 仓库中下载 `ubuntu/hirsuite64` 镜像。
|
||||
|
||||
```
|
||||
Bringing machine 'default' up with 'virtualbox' provider...
|
||||
==> default: Importing base box 'ubuntu/hirsute64'...
|
||||
==> default: Matching MAC address for NAT networking...
|
||||
==> default: Checking if box 'ubuntu/hirsute64' version '20210820.0.0' is up to date...
|
||||
==> default: Setting the name of the VM: a_default_1630204214778_76885
|
||||
==> default: Clearing any previously set network interfaces...
|
||||
==> default: Preparing network interfaces based on configuration...
|
||||
default: Adapter 1: nat
|
||||
default: Adapter 2: hostonly
|
||||
==> default: Forwarding ports...
|
||||
default: 22 (guest) => 2222 (host) (adapter 1)
|
||||
==> default: Running 'pre-boot' VM customizations...
|
||||
==> default: Booting VM...
|
||||
==> default: Waiting for machine to boot. This may take a few minutes...
|
||||
default: SSH address: 127.0.0.1:2222
|
||||
default: SSH username: vagrant
|
||||
default: SSH auth method: private key
|
||||
default: Warning: Remote connection disconnect. Retrying...
|
||||
default: Warning: Connection reset. Retrying...
|
||||
default:
|
||||
default: Vagrant insecure key detected. Vagrant will automatically replace
|
||||
default: this with a newly generated keypair for better security.
|
||||
default:
|
||||
default: Inserting generated public key within guest...
|
||||
default: Removing insecure key from the guest if it's present...
|
||||
default: Key inserted! Disconnecting and reconnecting using new SSH key...
|
||||
==> default: Machine booted and ready!
|
||||
```
|
||||
|
||||
此时,如果你打开你的 Vagrant 后端(如 VirtualBox 或 virt-manager),你会看到你的“盒子”已经有了。接下来,运行 `vagrant ssh` 登录到“盒子”。如果你能看到 Vagrant 的提示符,那么你就进入了!
|
||||
|
||||
```
|
||||
~ vagrant ssh
|
||||
Welcome to Ubuntu 21.04 (GNU/Linux 5.11.0-31-generic x86_64)
|
||||
|
||||
* Documentation: <https://help.ubuntu.com>
|
||||
* Management: <https://landscape.canonical.com>
|
||||
* Support: <https://ubuntu.com/advantage>
|
||||
|
||||
System information as of Sun Aug 29 02:33:51 UTC 2021
|
||||
|
||||
System load: 0.01 Processes: 110
|
||||
Usage of /: 4.1% of 38.71GB Users logged in: 0
|
||||
Memory usage: 17% IPv4 address for enp0s3: 10.0.2.15
|
||||
Swap usage: 0% IPv4 address for enp0s8: 192.168.1.20
|
||||
|
||||
0 updates can be applied immediately.
|
||||
|
||||
vagrant@ubuntu-hirsute:~$
|
||||
```
|
||||
|
||||
Vagrant 使用“基础盒子”来建立你的本地机器。在我们的例子中,Vagrant 从 [Hashicorp 的 Vagrant 目录][5]下载 `ubuntu/hirsuite64` 镜像,并插入 VirtualBox 来创建实际的“盒子”。
|
||||
|
||||
### 共享文件夹
|
||||
|
||||
Vagrant 将你的当前文件夹映射到 Vagrant “盒子”中的 `/vagrant`。这允许你在你的系统和“盒子”里保持文件同步。这很适合测试 Nginx 网站,通过将你的文件根目录指向 `/vagrant`。你可以使用 IDE 进行修改,“盒子”里的 Nginx 会提供这些修改。
|
||||
|
||||
### Vagrant 命令
|
||||
|
||||
有几个 Vagrant 命令,你可以用它们来控制你的“盒子”。
|
||||
|
||||
其中一些重要的命令是:
|
||||
|
||||
* `vagrant up`:启动一个“盒子”。
|
||||
* `vagrant status`:显示当前“盒子”的状态。
|
||||
* `vagrant suspend`:暂停当前的“盒子”。
|
||||
* `vagrant resume`:恢复当前的“盒子”。
|
||||
* `vagrant halt`:关闭当前的“盒子”。
|
||||
* `vagrant destroy`:销毁当前的“盒子”。通过运行此命令,你将失去存储在“盒子”上的任何数据。
|
||||
* `vagrant snapshot`:对当前的“盒子”进行快照。
|
||||
|
||||
### 试试 Vagrant
|
||||
|
||||
Vagrant 是一个使用 DevOps 原则进行虚拟机管理的工具,久经时间考验。配置你的测试机,与你的团队分享配置,并在一个可预测和可重复的环境中测试你的项目。如果你正在开发软件,那么通过使用 Vagrant 进行测试,你将为你的用户提供良好的服务。如果你不开发软件,但你喜欢尝试新版本的操作系统,那么没有比这更简单的方法了。今天就试试 Vagrant 吧!
|
||||
|
||||
这篇文章最初发表在 [作者的个人博客][6] 上,经许可后被改编。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/test-vagrant
|
||||
|
||||
作者:[Ayush Sharma][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/ayushsharma
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://opensource.com/article/21/6/try-linux-virtualbox
|
||||
[3]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization
|
||||
[4]: https://www.vagrantup.com/docs/installation
|
||||
[5]: https://app.vagrantup.com/boxes/search
|
||||
[6]: https://notes.ayushsharma.in/2021/08/introduction-to-vagrant
|
@ -3,24 +3,26 @@
|
||||
[#]: author: "Markus Feilner https://opensource.com/users/mfeilner"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13833-1.html"
|
||||
|
||||
Microsoft Exchange 的一个开源替代方案
|
||||
微软 Exchange 的一个开源替代方案
|
||||
======
|
||||
开源用户现在有了一个强大的、功能齐全的群件选择。
|
||||
![Working on a team, busy worklife][1]
|
||||
|
||||
多年来,Microsoft Exchange 作为群件环境的平台几乎是不可避免的。然而,在 2020 年末,一个奥地利的开源软件开发商推出了[grommunio][2],一个群件服务器和客户端,其外观和感觉对 Exchange 和 Outlook 用户所熟悉。
|
||||
> 开源用户现在有了一个强大的、功能齐全的群件选择。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/29/141404pesw8xgh8oohwhjh.jpg)
|
||||
|
||||
多年来,微软 Exchange 作为一个平台牢牢统治着群件环境。然而,在 2020 年末,一个奥地利的开源软件开发商推出了 [grommunio][2],这是一个群件服务器和客户端,其外观和感觉让 Exchange 和 Outlook 用户感到很熟悉。
|
||||
|
||||
grmmunio 项目可以很好地替代 Exchange。开发者以与微软相同的方式将组件连接到平台上,它们支持 RPC (远程过程调用)与 HTTP 协议。据开发者介绍,grommunio 还包括许多常见的群件接口,如 IMAP、POP3、SMTP、EAS(Exchange ActiveSync)、EWS(Exchange Web Services)、CalDAV 和 CardDAV。有了这样广泛的支持,grommunio 可以顺利地整合到现有的基础设施中。
|
||||
|
||||
用户会注意到 Outlook、Android 和 iOS 客户端之间几乎没有区别。当然,作为开源软件,它也支持其他客户端。由于集成了本地 Exchange 协议,Outlook 和智能手机与 grommunio 的通信就像与 Microsoft Exchange 服务器一样。日常的企业用户可以继续使用他们现有的客户端,而 grommunio 服务器则在后台安静地运行。
|
||||
用户会注意到对 Outlook、Android 和 iOS 客户端来说几乎没有区别。当然,作为开源软件,它也支持其他客户端。由于集成了原生的 Exchange 协议,Outlook 和智能手机与 grommunio 的通信就像与微软 Exchange 服务器一样。日常的企业用户可以继续使用他们现有的客户端,而 grommunio 服务器则在后台安静地运行。
|
||||
|
||||
### 不仅仅是邮件
|
||||
|
||||
除了邮件功能外,grommunio 界面还提供了日历系统。可以直接在日历显示中或在一个新标签中点击创建约会。这很直观,正是你对现代工具的期望。用户可以创建、管理和分享日历以及地址簿。私人联系人或普通联系人都是可能的,而且你可以与同事分享一切。
|
||||
除了邮件功能外,grommunio 界面还提供了日历系统。可以直接在日历显示中或在一个新标签中点击创建约会。这很直观,正如你对现代工具的期望。用户可以创建、管理和分享日历以及地址簿。私人联系人或普通联系人都支持,而且你可以与同事分享一切。
|
||||
|
||||
任务管理在左边的下拉菜单中显示任务列表,它们可以有一个所有者和多个合作者。你可以为每个任务指定截止日期、类别、附件和其他属性。笔记可以以同样的方式被管理并与其他团队成员共享。
|
||||
|
||||
@ -30,25 +32,25 @@ grmmunio 项目可以很好地替代 Exchange。开发者以与微软相同的
|
||||
|
||||
![Screenshot of grommunio meeting space][3]
|
||||
|
||||
用于高级视频会议的 Jitsi 集成(Markus Feilner, [CC BY-SA 4.0][4])
|
||||
*用于高级视频会议的 Jitsi 集成(Markus Feilner, [CC BY-SA 4.0][4])*
|
||||
|
||||
在 grommunio 会议功能的背后是 [Jitsi][5],它以熟悉的用户界面顺利地集成到 grommunio 的用户界面中。完全集成和集中管理的聊天功能是基于 [Mattermost][6]。
|
||||
|
||||
![Screenshot of grommunio's town square for chat][7]
|
||||
|
||||
用于聊天的 Mattermost(Markus Feilner,[CC BY-SA 4.0][4])
|
||||
*用于聊天的 Mattermost(Markus Feilner,[CC BY-SA 4.0][4])*
|
||||
|
||||
用于文件同步和交换的 ownCloud(Markus Feilner,[CC BY-SA 4.0][4])
|
||||
[ownCloud][8] 承诺提供企业级的文件共享和同步,在点击“文件”按钮后开始。
|
||||
|
||||
![Screenshot of grommunio file sharing space][9]
|
||||
|
||||
用于文件同步和交换的 ownCloud(Markus Feilner,[CC BY-SA 4.0][4])
|
||||
*用于文件同步和交换的 ownCloud(Markus Feilner,[CC BY-SA 4.0][4])*
|
||||
|
||||
grommunio 项目有一个强大的管理界面,包括角色、域和组织管理、预测性监测和自助服务门户。基于 shell 的向导指导管理员完成安装和从 Microsoft Exchange 迁移数据。开发团队正在不断努力,以实现更好的整合和更集中的管理,并随之为管理员提供更好的工作流程。
|
||||
grommunio 项目有一个强大的管理界面,包括角色、域和组织管理、预测性监测和自助服务门户。基于 shell 的向导指导管理员完成安装和从微软 Exchange 迁移数据。开发团队正在不断努力,以实现更好的整合和更集中的管理,并随之为管理员提供更好的工作流程。
|
||||
|
||||
![Screenshot of grommunio dashboards][10]
|
||||
|
||||
grommunio 的管理界面(Markus Feilner, [CC BY-SA 4.0][4])
|
||||
*grommunio 的管理界面(Markus Feilner, [CC BY-SA 4.0][4])*
|
||||
|
||||
### 探索 grommunio
|
||||
|
||||
@ -61,7 +63,7 @@ via: https://opensource.com/article/21/9/open-source-groupware-grommunio
|
||||
作者:[Markus Feilner][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/) 荣誉推出
|
||||
|
@ -0,0 +1,73 @@
|
||||
[#]: subject: "5 open source alternatives to Zoom"
|
||||
[#]: via: "https://opensource.com/article/21/9/alternatives-zoom"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13836-1.html"
|
||||
|
||||
5 个替代 Zoom 的开源软件
|
||||
======
|
||||
|
||||
> 试试这些开源视频会议服务之一。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/30/114413ylalu7dcl5au575v.jpg)
|
||||
|
||||
我最近参加了 [实用开源信息(POSI)][2] 会议,它是在一个自由开源的视频会议平台上举行的。当我参加了一系列关于开源软件的实际用途的精彩讲座时,我意识到视频会议在过去几年里已经变得非常普遍。
|
||||
|
||||
如果说开源做了什么,那就是提供了选择,现在越来越多的工人有了远程工作的自由,在你的连接方式上有一个选择是非常有意义的。
|
||||
|
||||
有时,你需要一个全功能的视频会议应用,其中包括审核、演示模式和分组讨论室,而其他时候,你想做的只是给朋友打一个快速电话,以便看到对方的脸。
|
||||
|
||||
### Jitsi
|
||||
|
||||
[Jitsi][3] 是一个简单、随意、但强大的视频通话平台。你可以自己托管它,也可以在 [meet.jit.si][4] 的公共实例上使用它。它有可定制的 URL,可以很容易地与你想见面的朋友分享链接、通话中的聊天、管理控制,和通话录音。它的开发非常活跃,每年都会测试和发布一大批新功能。它是 Opensource.com 用于我们每周会议的平台。
|
||||
|
||||
### Signal
|
||||
|
||||
[Signal][5] 已经是一个流行的以安全为重点的聊天应用,最近它又增加了 [团体视频通话][6] 的功能。视频通话非常适合简单的会议,而且因为你只能与你的 Signal 联系人列表中的其他人见面,所以不用担心你的视频通话会议上有不速之客。当你尝试定位你应该参与开会的虚拟房间时,也没有来回的“电话标签”。这一切都发生在 Signal 中,因此无需猜测。
|
||||
|
||||
Signal 本身是非常直观的,视频功能非常适合其现有惯例。简而言之,只要你的联系人在使用 Signal,这就是一个不费力的视频通话平台。这是我用于个人联系的应用,我经常使用其视频通话功能与朋友和家人联系。
|
||||
|
||||
### P2p.chat
|
||||
|
||||
[P2p.chat][7] 是这些中最简单的一个,无论是设计还是实现。通过 WebRTC 工作,p2p.chat 是一个 Web 应用,允许你直接连接到你正在呼叫的人,而不需要托管服务器。p2p.chat 的界面并不多,但这也是其吸引力的另一部分。没有管理控制或演示模式,因为 p2p.chat 在很大程度上是科幻片中承诺的“视频电话”:与远方的人进行轻松的人对人(或人们对人们)视频通话。
|
||||
|
||||
你可以使用自定义的 URL 来动态地创建一个会议空间,所以它们相对容易记忆(除了小的随机部分)和输入。我和不在 Signal 上的朋友使用 p2p.chat,它从未让我失望过。
|
||||
|
||||
### BigBlueButton
|
||||
|
||||
如果你需要严格的管理控制和极端的灵活性,[BigBlueButton][8] 是你正在寻找的解决方案,它专为教室、会议和演讲而设计。有了 BigBlueButton,你可以让所有与会者静音,阻止和踢走一个与会者,创建分组讨论室,创建协作式白板,共享屏幕,进行演讲,以及记录会议。与会者可以“举起手”表示注意,并将他们的状态设定为非语言交流方式。它很容易使用,但它是一个严肃的平台,适用于重点和非常大的群体。我参加过一些使用 BigBlueButton 的技术会议,包括 [实用开源信息(POSI)][2]会议。
|
||||
|
||||
### Wire
|
||||
|
||||
[Wire][9] 是寻找托管视频聊天和群件客户端的企业客户的绝佳选择。它是 [AGPL][10] 许可,这个开源项目可用于桌面和服务器、安卓和 iOS。它具有视频通话、发信和文件共享的功能,因此,即使是远程会议,基本上也有亲自开会的所有便利。你可以在有限的时间内免费试用 Wire,然后为你的公司购买一份支持合同。另外,你也可以自己托管它。
|
||||
|
||||
### 开源视频聊天
|
||||
|
||||
没有理由满足于由你可能不完全信任的公司托管的专有视频通话。今天可用的开源选项对于与你的职业和个人生活中的所有人保持联系是非常好的。下次你想和朋友见面时,不妨试试这些解决方案之一。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/alternatives-zoom
|
||||
|
||||
作者:[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/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app)
|
||||
[2]: https://opensource.org/posicfp
|
||||
[3]: http://jitsi.org
|
||||
[4]: http://meet.jit.si
|
||||
[5]: https://signal.org
|
||||
[6]: https://support.signal.org/hc/en-us/articles/360052977792-Group-Calling-Voice-or-Video-with-Screen-Sharing
|
||||
[7]: https://p2p.chat/
|
||||
[8]: https://bigbluebutton.org/
|
||||
[9]: https://wire.com/en/
|
||||
[10]: https://opensource.org/licenses/AGPL-3.0
|
164
published/202109/20210929 Manage CentOS Stream with Foreman.md
Normal file
164
published/202109/20210929 Manage CentOS Stream with Foreman.md
Normal file
@ -0,0 +1,164 @@
|
||||
[#]: subject: "Manage CentOS Stream with Foreman"
|
||||
[#]: via: "https://opensource.com/article/21/9/centos-stream-foreman"
|
||||
[#]: author: "Melanie Corr https://opensource.com/users/melanie-corr"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13837-1.html"
|
||||
|
||||
用 Foreman 管理 CentOS Stream
|
||||
======
|
||||
|
||||
> 这个例子让我们看到了在 Foreman 中管理和配置 CentOS Stream 内容的许多选项。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/30/133541s3e3s31yzmnugl1s.jpg)
|
||||
|
||||
2021 年 12 月,CentOS 8 将达到生命终点,被 CentOS Stream 取代。CentOS Stream 和 CentOS 之前的迭代之间的主要变化之一是没有小版本。Centos Stream 采用了一个连续的发布周期。从今年年初开始,Foreman 社区的开发者开始看到 CentOS Stream 由于持续发布而提供的更早的错误检测和补丁的好处。我们不再需要等待下一个版本来利用最新的变化和错误修复。[一位资深的 Linux 社区爱好者][2] 指出,此举也使 RHEL 开发者比以往更接近 FOSS 社区。
|
||||
|
||||
然而,如果你是一个拥有数百或数千台服务器的管理员,你可能想控制新的软件包何时被添加到特定的服务器。如果你正在寻找一个免费的开源工具,帮助你确保生产服务器的稳定性,同时允许你安全地从 Centos Stream 中拉入最新的变化用于开发和测试,这就是 Foreman 可以帮助你的地方。有了 Foreman,你可以在生命周期环境的各个阶段管理你的 Centos Stream 内容。
|
||||
|
||||
### Foreman 介绍
|
||||
|
||||
Foreman 是一个完整的物理和虚拟服务器的生命周期管理工具。有了 Foreman,系统管理员有能力轻松实现重复性任务的自动化,快速部署应用程序,并主动管理内部或云中的服务器。Foreman 为<ruby>配备<rt>provisioning</rt></ruby>管理、配置管理和监控提供了企业级解决方案。由于其插件架构,Foreman 可以以无数种方式进行扩展。使用 Katello 插件,你可以把 Foreman 作为一个完整的<ruby>内容管理<rt>content management</rt></ruby>工具来管理 CentOS Stream,以及其他许多内容类型。
|
||||
|
||||
通过 Foreman 和 Katello,你可以准确地定义你希望每个环境包含哪些软件包。例如,生产环境可能使用已被验证为稳定的软件包,而开发环境可能需要最新、最先进的软件包版本。你还可以跨生命周期环境推广<ruby>内容视图<rt>content view</rt></ruby>。让我们来看看 Foreman 是如何完成这个任务的。
|
||||
|
||||
我们在这篇文章中使用了网页用户界面,但 Foreman 也有一个强大的 CLI 和 API。Katello 插件为 Pulp 项目提供了一个工作流和网页用户界面,你可以在 [这篇文章][3] 中了解更多。我们在这里也提供了一个简单的工作流程,但是 Foreman 和 Katello 项目提供了许多不同的配置选项来满足你的具体需求。
|
||||
|
||||
本文假设 Foreman 和 Katello 已经安装完毕。关于如何安装的更多信息,请参阅 [Katello 安装手册][4]。
|
||||
|
||||
### 创建一个产品
|
||||
|
||||
第一步是在 Foreman 中创建一个<ruby>产品<rt>product</rt></ruby>。该产品的功能是作为一个内部标签来存储 CentOS Stream 存储库。
|
||||
|
||||
1. 在 Foreman 网页用户界面,导航到“<ruby>内容<rt>Content</rt></ruby> > <ruby>产品<rt>Products</rt></ruby>”,并点击“<ruby>创建产品<rt>Create Product</rt></ruby>”。
|
||||
2. 在“<ruby>名称<rt>Name</rt></ruby>”字段中,为产品输入一个名称。Foreman会根据你输入的“<ruby>名称<rt>Name</rt></ruby>”自动完成“<ruby>标签<rt>Label</rt></ruby>”字段,以后不能再更改。
|
||||
|
||||
### 将 CentOS Stream 存储库添加到产品中
|
||||
|
||||
现在你有了一个产品,你可以使用 AppStream 和 BaseOS 存储库的 URL,并将它们添加到你的新产品中。
|
||||
|
||||
1. 在 Foreman 网页用户界面中,导航到 “<ruby>内容<rt>Content</rt></ruby> > <ruby>产品<rt>Products</rt></ruby>”,选择你要使用的产品,然后点击 “<ruby>新存储库<rt>New Repository</rt></ruby>”。
|
||||
2. 在“<ruby>名称<rt>Name</rt></ruby>”字段中,为存储库输入一个名称;例如,“Centos8StreamBaseOS”。Foreman 会根据你输入的“<ruby>名称<rt>Name</rt></ruby>”,自动完成“<ruby>标签<rt>Label</rt></ruby>”字段。
|
||||
3. 从“<ruby>类型<rt>Type</rt></ruby>”列表中,选择存储库的类型,然后选择“Yum”。
|
||||
4. 在 “URL” 字段中,输入 CentOS Stream Baseos 存储库的 URL,作为源: `http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/`。
|
||||
5. 选择“<ruby>下载规则<rt>Download Policy</rt></ruby>”列表。默认的是“<ruby>按需<rt>On Demand</rt></ruby>”,这意味着 Katello 将只下载元数据。如果你想下载所有的软件包,请改成“<ruby>即时<rt>Immediate</rt></ruby>”,它可以下载所有的软件包,可能会达到 20-30GB。
|
||||
6. 确保“<ruby>与镜像同步<rt>Mirror on Sync</rt></ruby>”复选框被选中。这个选项确保在同步过程中,不再是上游存储库的一部分的内容被删除。
|
||||
7. 点击“<ruby>保存<rt>Save</rt></ruby>”。
|
||||
|
||||
|
||||
|
||||
重复这些步骤,添加 AppStream 存储库及其 URL,例如,`http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/`。确保你使用最近的官方 CentOS 镜像来代替它。
|
||||
|
||||
要执行立即同步,在你的产品窗口,点击“<ruby>立即同步<rt>Sync Now</rt></ruby>”。最初的同步可能需要一些时间。你可以从“<ruby>内容<rt>Content</rt></ruby> > <ruby>同步状态<rt>Sync Status</rt></ruby>”查看同步状态。
|
||||
|
||||
同步完成后,你可以在“<ruby>主机<rt> Hosts</rt></ruby> > <ruby>操作系统<rt>Operating System</rt></ruby>”中查看新的 CentOS Stream 操作系统。请随意编辑名称和描述以满足你的要求。
|
||||
|
||||
如果你打算使用 Ansible 或 Puppet 等配置管理软件,Foreman 会自动创建一个操作系统报告。你可以在“<ruby>管理<rt>Administe</rt></ruby> > <ruby>设置<rt>Settings</rt></ruby> > <ruby>忽略操作系统状况<rt>Ignore facts for operating system</rt></ruby>”中关闭这个选项。重命名操作系统以匹配配置管理软件中的名称是一个好主意。例如,对于 Puppet,这将是“CentOS 8”。
|
||||
|
||||
### 定义你的基础设施的生命周期环境
|
||||
|
||||
应用程序生命周期是 Foreman 的内容管理功能的一个核心概念。应用程序的生命周期定义了一个特定的系统和它的软件在特定阶段的状况。例如,一个应用程序的生命周期可能很简单,你可能只有一个“开发”阶段和“生产”阶段。Foreman 提供了一些方法来以可控的方式定制每个应用生命周期阶段,以适应你的规范。
|
||||
|
||||
在这一点上,你必须创建你的生命周期环境路径。
|
||||
|
||||
1. 在 Foreman 网页用户界面中,导航到“<ruby>内容<rt>Content</rt></ruby> > <ruby>生命周期环境<rt>Lifecycle Environments</rt></ruby>”。
|
||||
2. 点击“<ruby>新环境路径<rt>New Environment Path</rt></ruby>”,开始一个新的应用生命周期。
|
||||
3. 在“<ruby>名称<rt>Name</rt></ruby>”字段中,为你的环境输入一个名称。
|
||||
4. 在“<ruby>描述<rt>Description</rt></ruby>”字段中,为你的环境输入一个描述。
|
||||
5. 点击“<ruby>保存<rt>Save</rt></ruby>”。
|
||||
6. 根据你的需要添加尽可能多的环境路径。例如,你可以创建“dev”、“test”、“stage” 和 “production” 环境。要添加这些环境,点击“添加新环境”,完成“<ruby>名称<rt>Name</rt></ruby>”和“<ruby>描述<rt>Description</rt></ruby>”字段,并从“<ruby>优先环境<rt>Prior Environment*</rt></ruby>”列表中选择先前的环境,这样你就可以按照你预期使用的顺序将它们串联起来。
|
||||
|
||||
|
||||
|
||||
### 创建和发布一个内容视图
|
||||
|
||||
在 Foreman 中,“<ruby>内容视图<rt>Content View</rt></ruby>”是你的存储库在某个特定时间点的快照。内容视图提供了隔离软件包版本到你想保留的状态的机制。内容视图有很多可配置的功能,你可以用它来进一步细化。为了本教程的目的,让我们保持简单。
|
||||
|
||||
1. 在 Foreman 网页用户界面中,导航到“<ruby>内容<rt>Content</rt></ruby> > <ruby>内容视图<rt>Content View</rt></ruby>”,并点击“<ruby>创建新视图<rt>Create New View</rt></ruby>”。
|
||||
2. 在“<ruby>名称<rt>Name</rt></ruby>”字段中,为视图输入一个名称。Foreman 会根据你输入的名称自动完成“<ruby>标签<rt>Label</rt></ruby>”字段。
|
||||
3. 在“<ruby>描述<rt>Description</rt></ruby>”字段中,输入视图的描述。
|
||||
4. 单击“<ruby>保存<rt>Save</rt></ruby>”以创建内容视图。
|
||||
5. 在新的内容视图中,点击“<ruby>Yum 内容<rt>Yum Contents</rt></ruby> > <ruby>添加存储库<rt>Add Repositories</rt></ruby>”,在“<ruby>存储库选择<rt>Repository Selection</rt></ruby>”区域,点击“<ruby>添加<rt>Add</rt></ruby>”。对于 BaseOS 和 Appstream 存储库,选择你想包括的软件包,然后点击“<ruby>添加存储库<rt>Add Repositories</rt></ruby>”。
|
||||
6. 点击“<ruby>发布新版本<rt>Publish New Version</rt></ruby>”,在“<ruby>描述<rt>Description</rt></ruby>”区域,输入关于版本的信息以记录变化。
|
||||
7. 单击“<ruby>保存<rt>Save</rt></ruby>”。
|
||||
|
||||
当你点击“<ruby>发布新版本<rt>Publish New Version</rt></ruby>”时,你创建了一个你已同步的所有内容的快照。这意味着你订阅此内容视图的每台服务器将只能访问与此生命周期环境相关的内容视图中的软件包版本。
|
||||
|
||||
每一个新的内容视图和后续版本都会首先发布到库环境,然后你可以在那里推广到其他环境。
|
||||
|
||||
### 跨生命周期环境推广内容
|
||||
|
||||
如果你已经测试了新的软件包,并且确信一切都很稳定,你可以把你的内容视图推广到另一个生命周期环境中。
|
||||
|
||||
1. 导航到“<ruby>内容<rt>Content</rt></ruby> > <ruby>内容视图<rt>Content Views</rt></ruby>”,选择你想推广的内容视图。
|
||||
2. 点击内容视图的“<ruby>版本<rt>Versions</rt></ruby>”标签。
|
||||
3. 选择你想推广的版本,并在“<ruby>操作<rt>Action</rt></ruby>”栏中,点击“<ruby>推广<rt>Promote</rt></ruby>”。
|
||||
4. 选择你要推广内容视图的环境,并点击“<ruby>推广版本<rt>Promote Version</rt></ruby>”。
|
||||
5. 再次点击“<ruby>推广<rt>Promote</rt></ruby>”按钮。这次选择生命周期环境,例如,“Test”,然后单击“<ruby>推广版本<rt>Promote Version</rt></ruby>”。
|
||||
6. 最后,再次点击“<ruby>推广<rt>Promote</rt></ruby>”按钮。例如,选择“Production”环境并点击“<ruby>推广版本<rt>Promote Version</rt></ruby>”。
|
||||
|
||||
被分配到该特定环境的服务器现在可以从一套更新的软件包中提取。
|
||||
|
||||
### 创建一个激活密钥
|
||||
|
||||
为了将 CentOS Stream 服务器注册到你在特定生命周期中定义的内容,你必须创建一个激活密钥。激活密钥是一种与服务器共享凭证的安全方法。这使用了一个叫做“<ruby>订阅管理器<rt>subscription-manager</rt></ruby>的工具来订阅 CentOS Stream 服务器的内容。
|
||||
|
||||
当你创建了激活密钥后,将 CentOS Stream 订阅添加到激活密钥中。
|
||||
|
||||
1. 在 Foreman 网页用户界面中,导航到“<ruby>内容<rt>Content</rt></ruby> > <ruby>激活密钥<rt>Activation keys</rt></ruby>”,并点击“<ruby>创建激活密钥<rt>Create Activation Key</rt></ruby>”。
|
||||
2. 在“<ruby>名称<rt>Name</rt></ruby>”栏中,输入激活密钥的名称。
|
||||
3. 在“<ruby>描述<rt>Description</rt></ruby>”栏中,输入激活密钥的描述。
|
||||
4. 从“<ruby>环境<rt>Environment</rt></ruby>”列表中,选择要使用的环境。
|
||||
5. 从“<ruby>内容视图<rt>Content View</rt></ruby>”列表中,选择你刚才创建的内容视图。
|
||||
6. 点击“<ruby>保存<rt>Save</rt></ruby>”。
|
||||
|
||||
###从 Foreman 管理的内容中创建一个 CentOS Stream 主机
|
||||
|
||||
现在一切都准备好了。随着你创建的内容包含在内容视图中,并在整个生命周期中推广,你现在可以准确地用你想使用的内容来配置主机,并订阅你想让它们接收的更新。
|
||||
|
||||
要在 Foreman 中创建一个主机,请导航到“主机 > 创建主机”。
|
||||
|
||||
1. 在“<ruby>名称<rt>Name</rt></ruby>”字段中,为主机输入一个名称。
|
||||
2. 单击“<ruby>组织<rt>Organization</rt></ruby>”和“<ruby>位置<rt>Location</rt></ruby>”选项卡,以确保配置环境自动设置为当前环境。
|
||||
3. 从“<ruby>部署在<rt>Deploy On</rt></ruby>”列表中,选择“<ruby>裸金属<rt>Bare Metal</rt></ruby>”。
|
||||
4. 单击“<ruby>操作系统<rt>Operating System</rt></ruby>”选项卡。
|
||||
5. 从“<ruby>架构<rt>Architectures</rt></ruby>”列表中,选择“x86_64”。
|
||||
6. 从“<ruby>操作系统<rt>Operating System</rt></ruby>”列表中,选择“CentOS_Stream 8”。
|
||||
7. 勾选“<ruby>构建模式<rt>Build Mode</rt></ruby>”框。
|
||||
8. 对于“<ruby>媒体选择<rt>Media Selection</rt></ruby>”,选择“<ruby>同步的内容<rt>Synced Content</rt></ruby>”来使用你之前同步的 CentOS Stream 内容。
|
||||
9. 从“<ruby>同步的内容<rt>Synced Content</rt></ruby>”列表中,确保选择 “CentOS Stream”。
|
||||
10. 从“<ruby>分区表<rt>Partition Table</rt></ruby>”列表中,对于这个演示,选择默认的 “Kickstart”,但有许多可用的选项。
|
||||
11. 在“<ruby>Root 密码<rt>Root Password</rt></ruby>”栏中,为你的新主机输入一个 root 密码。
|
||||
12. 点击“<ruby>接口<rt>Interface</rt></ruby>”标签,并点击“<ruby>编辑<rt>Edit</rt></ruby>”,并添加一个 “<ruby>Mac 地址<rt>Mac address</rt></ruby>”。
|
||||
13. 点击“<ruby>参数<rt>Parameters</rt></ruby>”标签,并确保存在一个提供激活密钥的参数。如果没有,添加一个激活密钥。
|
||||
14. 点击“<ruby>提交<rt>Submit</rt></ruby>”以保存主机条目。
|
||||
|
||||
|
||||
|
||||
现在,新的主机处于构建模式,这意味着当你打开它时,它将开始安装操作系统。
|
||||
|
||||
如果你导航到“<ruby>主机<rt>Hosts</rt></ruby> > <ruby>内容主机<rt>Content Hosts</rt></ruby>”,你可以看到你的主机所订阅的订阅、生命周期环境和内容视图的全部细节。
|
||||
|
||||
这个例子只是对你在 Foreman 中管理和配置 CentOS Stream 内容的众多选项的一个小窥视。如果你想了解更多关于如何管理 CentOS Stream 版本,控制你的服务器可以访问的内容,以及控制和保护你的基础设施的稳定性的详细信息,请查看 [Foreman 内容管理][5] 文档。当所有 CentOS Stream 内容在你的控制之下时,你可以创建和注册 Centos Stream,只使用你指定的内容。有关配备的更多详细信息,请参见 [Foreman 配备][6] 文档。如果你有任何问题、反馈或建议,你可以在 <https://community.theforeman.org/> 找到 Foreman 社区。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/centos-stream-foreman
|
||||
|
||||
作者:[Melanie Corr][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/melanie-corr
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen)
|
||||
[2]: https://twitter.com/Det_Conan_Kudo/status/1337366036023218177?s=20
|
||||
[3]: https://opensource.com/article/20/8/manage-repositories-pulp
|
||||
[4]: https://docs.theforeman.org/3.0/Installing_Server_on_Red_Hat/index-katello.html
|
||||
[5]: https://docs.theforeman.org/master/Content_Management_Guide/index-foreman.html
|
||||
[6]: https://docs.theforeman.org/master/Provisioning_Guide/index-foreman.html
|
181
published/20210907 How to use BusyBox on Linux.md
Normal file
181
published/20210907 How to use BusyBox on Linux.md
Normal file
@ -0,0 +1,181 @@
|
||||
[#]: subject: "How to use BusyBox on Linux"
|
||||
[#]: via: "https://opensource.com/article/21/8/what-busybox"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13840-1.html"
|
||||
|
||||
如何在 Linux 上使用 BusyBox
|
||||
======
|
||||
|
||||
> BusyBox 是一个开源(GPL)项目,提供了近 400 个常用命令的简单实现。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/01/185208x6ckkmvi0silk3vk.jpg)
|
||||
|
||||
我们很容易认为 Linux 的命令是理所当然的。当你安装 Linux 时,它们与系统捆绑在一起,而我们常常不问为什么它们会在那里。一些基本的命令,如 [cd][2]、[kill][3] 和 echo,并不总是独立的应用程序,而是实际上内置于你的 shell 中。其他如 [ls][4]、[mv][5] 和 [cat][6] 是核心工具包(通常是 GNU `coreutils`)的一部分。但在开源的世界里,总是有一些替代品,其中最有趣的是 [BusyBox][7]。
|
||||
|
||||
### Linux 中的 BusyBox 简介
|
||||
|
||||
BusyBox 是一个开源(GPL)项目,提供近 400 个常用命令的简单实现,包括 `ls`、`mv`、`ln`、`mkdir`、`more`、`ps`、`gzip`、`bzip2`、`tar` 和 `grep`。它还包含了编程语言 `awk`、流编辑器 `sed`、文件系统检查工具 `fsck`、`rpm` 和 `dpkg` 软件包管理器,当然还有一个可以方便的访问所有这些命令的 shell(`sh`)。简而言之,它包含了所有 POSIX 系统需要的基本命令,以执行常见的系统维护任务以及许多用户和管理任务。
|
||||
|
||||
事实上,它甚至包含一个 `init` 命令,可以作为 PID 1 启动,以作为所有其它系统服务的父进程。换句话说,BusyBox 可以作为 [systemd][8]、OpenRC、sinit、init 和其他初始化系统的替代品。
|
||||
|
||||
BusyBox 非常小。作为一个可执行文件,它不到 1MB,所以它在 [嵌入式][9]、[边缘计算][10] 和 [物联网][11] 领域很受欢迎,因为这些场景的存储空间是很宝贵的。在容器和云计算的世界里,它作为精简的 Linux 容器镜像的基础镜像也很受欢迎。
|
||||
|
||||
### 极简主义
|
||||
|
||||
BusyBox 的部分魅力在于它的极简主义。它的所有命令都被编译到一个二进制文件里(`busybox`),它的手册只有 81 页(根据我对 `man` 送到 `pr` 管道的计算),但它涵盖了近 400 条命令。
|
||||
|
||||
作为一个例子的比较,这是 “原版” 的 `useradd —help` 的输出:
|
||||
|
||||
```
|
||||
-b, --base-dir BASE_DIR base directory for home
|
||||
-c, --comment COMMENT GECOS field of the new account
|
||||
-d, --home-dir HOME_DIR home directory of the new account
|
||||
-D, --defaults print or change the default config
|
||||
-e, --expiredate EXPIRE_DATE expiration date of the new account
|
||||
-f, --inactive INACTIVE password inactivity
|
||||
-g, --gid GROUP name or ID of the primary group
|
||||
-G, --groups GROUPS list of supplementary groups
|
||||
-h, --help display this help message and exit
|
||||
-k, --skel SKEL_DIR alternative skeleton dir
|
||||
-K, --key KEY=VALUE override /etc/login.defs
|
||||
-l, --no-log-init do not add the user to the lastlog
|
||||
-m, --create-home create the user's home directory
|
||||
-M, --no-create-home do not create the user's home directory
|
||||
-N, --no-user-group do not create a group with the user's name
|
||||
-o, --non-unique allow users with non-unique UIDs
|
||||
-p, --password PASSWORD encrypted password of the new account
|
||||
-r, --system create a system account
|
||||
-R, --root CHROOT_DIR directory to chroot into
|
||||
-s, --shell SHELL login shell of the new account
|
||||
-u, --uid UID user ID of the new account
|
||||
-U, --user-group create a group with the same name as a user
|
||||
```
|
||||
|
||||
而这是是同一命令的 BusyBox 版本:
|
||||
|
||||
```
|
||||
-h DIR Home directory
|
||||
-g GECOS GECOS field
|
||||
-s SHELL Login shell
|
||||
-G GRP Group
|
||||
-S Create a system user
|
||||
-D Don't assign a password
|
||||
-H Don't create home directory
|
||||
-u UID User id
|
||||
-k SKEL Skeleton directory (/etc/skel)
|
||||
```
|
||||
|
||||
这种差异是一种特性还是一种限制,取决于你是喜欢你的命令拥有 20 个选项还是 10 个选项。对于一些用户和某些用例来说,BusyBox 的极简主义刚刚满足所需。对于其他人来说,它是一个很好的最小化环境,可以作为一个后备工具,或者作为安装更强大的工具的基础,比如 [Bash][12]、[Zsh][13]、GNU [Awk][14] 等等。
|
||||
|
||||
### 安装 BusyBox
|
||||
|
||||
在 Linux 上,你可以使用你的软件包管理器安装 BusyBox。例如,在 Fedora 及类似发行版:
|
||||
|
||||
```
|
||||
$ sudo dnf install busybox
|
||||
```
|
||||
|
||||
在 Debian 及其衍生版:
|
||||
|
||||
```
|
||||
$ sudo apt install busybox
|
||||
```
|
||||
|
||||
在 MacOS 上,可以使用 [MacPorts][15] 或 [Homebrew][16]。在 Windows 上,可以使用 [Chocolatey][17]。
|
||||
|
||||
你可以将 BusyBox 设置为你的 shell,使用 `chsh —shell` 命令,然后再加上 BusyBox `sh` 应用程序的路径。我把 BusyBox 放在 `/lib64` 中,但它的位置取决于你的发行版的安装位置。
|
||||
|
||||
```
|
||||
$ which busybox
|
||||
/lib64/busybox/busybox
|
||||
$ chsh --shell /lib64/busybox/sh
|
||||
```
|
||||
|
||||
用 BusyBox 全盘替换所有常见的命令要复杂一些,因为大多数发行版都是“硬接线”,会在特定的软件包寻找特定的命令。换句话说,虽然技术上可以用 BusyBox 的 `init` 替换系统的 `init`,但你的软件包管理器可能会拒绝让你删除包含 `init` 的软件包,以免你担心删除会导致系统无法启动。有一些发行版是建立在 BusyBox 之上的,所以从新环境开始可能是体验 BusyBox 系统的最简单方法。
|
||||
|
||||
### 试试 BusyBox
|
||||
|
||||
你不必为了尝试 BusyBox 而将你的 shell 永久改为 BusyBox。你可以从你当前的 shell 中启动一个 BusyBox shell。
|
||||
|
||||
```
|
||||
$ busybox sh
|
||||
~ $
|
||||
```
|
||||
|
||||
不过你的系统仍然有安装的非 BusyBox 版本的命令,所以要体验 BusyBox 的工具,你必须把命令作为参数发给 `busybox` 可执行文件:
|
||||
|
||||
```
|
||||
~ $ busybox echo $0
|
||||
sh
|
||||
~ $ busybox ls --help
|
||||
BusyBox vX.YY.Z (2021-08-25 07:31:48 NZST) multi-call binary.
|
||||
|
||||
Usage: ls [-1AaCxdLHRFplinshrSXvctu] [-w WIDTH] [FILE]...
|
||||
|
||||
List directory contents
|
||||
|
||||
-1 One column output
|
||||
-a Include entries that start with .
|
||||
-A Like -a, but exclude . and ..
|
||||
-x List by lines
|
||||
[...]
|
||||
```
|
||||
|
||||
为了获得“完整”的 BusyBox 体验,你可以为每个命令创建一个 `busybox` 的符号链接。这很容易,只要你使用 [for 循环][18] 就行:
|
||||
|
||||
```
|
||||
$ mkdir bbx
|
||||
$ for i in $(bbx --list); do \
|
||||
ln -s /path/to/busybox bbx/$i \
|
||||
done
|
||||
```
|
||||
|
||||
在你的 [路径][19] 的 _开头_ 添加这个符号链接目录,并启动 BusyBox:
|
||||
|
||||
```
|
||||
$ PATH=$(pwd)/bbx:$PATH bbx/sh
|
||||
```
|
||||
|
||||
### 用起来
|
||||
|
||||
BusyBox 是一个有趣的项目,也是一个可以实现 _极简_ 计算的例子。无论你是把 BusyBox 作为 [你唤醒的][21] [古老的计算机][20] 的轻量级环境,还是作为 [嵌入式设备][22] 的用户界面,抑或试用一个新的初始化系统,就算是为了好奇,让自己重新认识那些熟悉而又陌生的命令,都会很有意思。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/what-busybox
|
||||
|
||||
作者:[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/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
|
||||
[2]: https://opensource.com/article/21/8/navigate-linux-directories
|
||||
[3]: https://opensource.com/article/18/5/how-kill-process-stop-program-linux
|
||||
[4]: https://opensource.com/article/19/7/master-ls-command
|
||||
[5]: https://opensource.com/article/19/8/moving-files-linux-depth
|
||||
[6]: https://opensource.com/article/19/2/getting-started-cat-command
|
||||
[7]: https://www.busybox.net
|
||||
[8]: https://opensource.com/article/20/4/systemd
|
||||
[9]: https://opensource.com/article/21/3/rtos-embedded-development
|
||||
[10]: https://opensource.com/article/17/9/what-edge-computing
|
||||
[11]: https://opensource.com/article/21/3/iot-measure-raspberry-pi
|
||||
[12]: https://opensource.com/article/20/4/bash-sysadmins-ebook
|
||||
[13]: https://opensource.com/article/19/9/getting-started-zsh
|
||||
[14]: https://opensource.com/article/20/9/awk-ebook
|
||||
[15]: https://opensource.com/article/20/11/macports
|
||||
[16]: https://opensource.com/article/20/6/homebrew-mac
|
||||
[17]: https://opensource.com/article/20/3/chocolatey
|
||||
[18]: https://opensource.com/article/19/10/programming-bash-loops
|
||||
[19]: https://opensource.com/article/17/6/set-path-linux
|
||||
[20]: https://opensource.com/article/20/2/restore-old-computer-linux
|
||||
[21]: https://opensource.com/article/19/7/how-make-old-computer-useful-again
|
||||
[22]: https://opensource.com/article/20/6/open-source-rtos
|
@ -0,0 +1,151 @@
|
||||
[#]: subject: "Install AnyDesk on Ubuntu Linux [GUI and Terminal Methods]"
|
||||
[#]: via: "https://itsfoss.com/install-anydesk-ubuntu/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13839-1.html"
|
||||
|
||||
在 Ubuntu Linux 上安装 AnyDesk
|
||||
======
|
||||
|
||||
> 这个初学者的教程讨论了在基于 Ubuntu 的 Linux 发行版上安装 AnyDesk 的 GUI 和终端方法。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/01/165758y9aaiix7yu88ayui.jpg)
|
||||
|
||||
[AnyDesk][1] 是一个流行的远程桌面软件,可用于 Linux、Windows、BSD、macOS 和移动平台。
|
||||
|
||||
有了 AnyDesk,你可以用它远程访问其他电脑,或者让别人远程访问你的系统。不是每个人都可以访问它,因为需要两台设备都使用 AnyDesk。你必须接受传入的连接和/或提供一个安全连接的密码。
|
||||
|
||||
这对于向朋友、家人、同事甚至客户提供技术支持很有帮助。
|
||||
|
||||
在本教程中,我将向你展示在 Ubuntu 上安装 AnyDesk 的图形和命令行两种方法。你可以根据自己的喜好使用这两种方法。这两种方法都会在你的 Ubuntu 系统上安装相同的 AnyDesk 版本。
|
||||
|
||||
同样的方法应该适用于 Debian 和其他基于 Debian 和 Ubuntu 的发行版,如 Linux Mint,Linux Lite 等。
|
||||
|
||||
> **非 FOSS 警告!**
|
||||
>
|
||||
> AnyDesk 不是开源软件。这里涉及它是因为它在 Linux 上可用,而文章的重点是 Linux。
|
||||
|
||||
### 方法 1:使用终端在 Ubuntu 上安装 AnyDesk
|
||||
|
||||
在你的系统上 [打开终端程序][2]。你需要一个像 `wget` 这样的工具来 [在终端下载文件][3],使用以下命令:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install wget
|
||||
```
|
||||
|
||||
下一步是下载 AnyDesk 仓库的 GPG 密钥,并将其添加到你的系统的可信密钥中。这样,你的系统就会信任来自这个[外部仓库][4]的软件。
|
||||
|
||||
```
|
||||
wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | sudo apt-key add -
|
||||
```
|
||||
|
||||
你可以暂时忽略关于 `apt-key` 命令的废弃警告。下一步是将 AnyDesk 仓库添加到系统的仓库源中:
|
||||
|
||||
```
|
||||
echo "deb http://deb.anydesk.com/ all main" | sudo tee /etc/apt/sources.list.d/anydesk-stable.list
|
||||
```
|
||||
|
||||
更新包缓存,这样你的系统就能通过新添加的仓库了解到新应用的可用性。
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
现在,你可以安装 AnyDesk 了:
|
||||
|
||||
```
|
||||
sudo apt install anydesk
|
||||
```
|
||||
|
||||
完成后,你可以从系统菜单或从终端本身启动 AnyDesk:
|
||||
|
||||
```
|
||||
anydesk
|
||||
```
|
||||
|
||||
你现在可以享受 AnyDesk 了。
|
||||
|
||||
![AnyDesk running in Ubuntu][5]
|
||||
|
||||
### 方法 2:在 Ubuntu 上以图形方式安装 AnyDesk
|
||||
|
||||
如果你不习惯使用命令行,不用担心。你也可以不进入终端安装 AnyDesk。
|
||||
|
||||
你可以从 AnyDesk 官网下载 Ubuntu 上的 AnyDesk:
|
||||
|
||||
- [下载 Linux 上的 Anydesk][6]
|
||||
|
||||
你会看到一个“Download Now”的按钮。点击它。
|
||||
|
||||
![Download AnyDesk][7]
|
||||
|
||||
当你点击下载按钮时,它会给你提供各种 Linux 发行版的选项。选择 Ubuntu 的那个:
|
||||
|
||||
![Download the appropriate file][8]
|
||||
|
||||
它将下载 AnyDesk 的 DEB 文件。[安装 DEB 文件][9]很简单。要么双击它,要么右击并使用软件安装打开。
|
||||
|
||||
![Right click on deb file and open with software center][10]
|
||||
|
||||
软件中心应用将被打开,你可以在那里安装它。
|
||||
|
||||
![Installing AnyDesk in Ubuntu software center][11]
|
||||
|
||||
安装后,在系统菜单中搜索它并从那里开始。
|
||||
|
||||
![AnyDesk installed in Ubuntu][12]
|
||||
|
||||
这就好了。不是太难,是吗?
|
||||
|
||||
我不打算展示使用 AnyDesk 的步骤。我想你已经对这个问题有了一些了解。如果没有,请参考 [这篇文章][13]。
|
||||
|
||||
#### 故障排除提示
|
||||
|
||||
当我试图从系统菜单中运行 AnyDesk 时,它没有启动。于是,我从终端启动它,它显示了这个错误:
|
||||
|
||||
```
|
||||
[email protected]:~$ anydesk
|
||||
anydesk: error while loading shared libraries: libpangox-1.0.so.0: cannot open shared object file: No such file or directory
|
||||
```
|
||||
|
||||
如果你看到 “[error while loading shared libraries][14]” 信息,你要安装它所报错的软件包。在我的例子中,我是这样做的:
|
||||
|
||||
```
|
||||
sudo apt install libpangox-1.0-0
|
||||
```
|
||||
|
||||
这解决了我的问题,我希望它也能为你解决。
|
||||
|
||||
如果你有任何与此主题相关的问题,请在评论区告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-anydesk-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://anydesk.com/en
|
||||
[2]: https://itsfoss.com/open-terminal-ubuntu/
|
||||
[3]: https://itsfoss.com/download-files-from-linux-terminal/
|
||||
[4]: https://itsfoss.com/adding-external-repositories-ubuntu/
|
||||
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/anydesk-running-in-ubuntu.png?resize=800%2C418&ssl=1
|
||||
[6]: https://anydesk.com/en/downloads/linux
|
||||
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/any-desk-ubuntu-download.webp?resize=800%2C312&ssl=1
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/any-desk-ubuntu-download-1.webp?resize=800%2C427&ssl=1
|
||||
[9]: https://itsfoss.com/install-deb-files-ubuntu/
|
||||
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/install-anaydesk-ubuntu.png?resize=800%2C403&ssl=1
|
||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/installing-anydesk-in-ubuntu-software-center.png?resize=781%2C405&ssl=1
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/anydesk-installed-in-ubuntu.png?resize=759%2C196&ssl=1
|
||||
[13]: https://support.anydesk.com/Access
|
||||
[14]: https://itsfoss.com/solve-open-shared-object-file-quick-tip/
|
@ -0,0 +1,117 @@
|
||||
[#]: subject: "Install Java from your Linux distribution's repositories"
|
||||
[#]: via: "https://opensource.com/article/21/9/install-java-linux-repositories"
|
||||
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13864-1.html"
|
||||
|
||||
如何从 Linux 发行版的仓库中安装 Java
|
||||
======
|
||||
|
||||
> 无论你喜欢哪个发行版和包管理器,都可以都很容易地在你的 Linux 系统上安装 Java。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/09/092717ean17be0alz10kt5.jpg)
|
||||
|
||||
把 Java 安装到你的 Linux 桌面上有多种方法。一个明显的方式是使用你的 Linux 发行版中提供的软件包。请注意,这并不适合所有人。例如,有些用户可能需要一个非常具体的 Java 版本。
|
||||
|
||||
在你开始之前,你必须确定你需要“哪种 Java”。你是否只需要运行一些 `.class` 文件或 `.jar` 文件?还是你正在编写一些需要编译的代码?
|
||||
|
||||
就我而言,我运行的大部分 Java 都是我自己(至少部分)编写的 Java,所以安装完整的 Java 开发工具包(或称 JDK)总是有意义的,它包含了 Java 编译器、库和一些非常有用的工具。当然,在这里,我们更倾向于使用开源的 JDK,称为 [OpenJDK][2]。
|
||||
|
||||
由于我主要在 Ubuntu Linux 发行版上工作,我的软件包管理器是 `apt`。我可以用 `apt` 来查找哪些 OpenJDK 包是可用的:
|
||||
|
||||
```
|
||||
apt list OpenJDK\*
|
||||
```
|
||||
|
||||
这个命令的输出看起来像这样:
|
||||
|
||||
```
|
||||
Listing... Done
|
||||
openjdk-11-dbg/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-dbg/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-demo/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-demo/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-doc/hirsute-updates,hirsute-updates,hirsute-security,hirsute-security 11.0.11+9-0ubuntu2 all
|
||||
openjdk-11-jdk-headless/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-jdk-headless/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-jdk/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-jdk/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-jre-dcevm/hirsute 11.0.10+1-1 amd64
|
||||
openjdk-11-jre-headless/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-jre-headless/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-jre-zero/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-jre-zero/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-jre/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 amd64
|
||||
openjdk-11-jre/hirsute-updates,hirsute-security 11.0.11+9-0ubuntu2 i386
|
||||
openjdk-11-source/hirsute-updates,hirsute-updates,hirsute-security,hirsute-security 11.0.11+9-0ubuntu2 all
|
||||
openjdk-15-dbg/hirsute 15.0.3+3-1 amd64
|
||||
openjdk-15-dbg/hirsute 15.0.3+3-1 i386
|
||||
openjdk-15-demo/hirsute 15.0.3+3-1 amd64
|
||||
...
|
||||
openjdk-8-jre/hirsute-updates,hirsute-security 8u292-b10-0ubuntu1 i386
|
||||
openjdk-8-source/hirsute-updates,hirsute-updates,hirsute-security,hirsute-security 8u292-b10-0ubuntu1 all
|
||||
```
|
||||
|
||||
我在上面用 `...` 省略了不少行。
|
||||
|
||||
事实证明,即使限制在 OpenJDK 中,我仍然有很多选择:
|
||||
|
||||
* 不同的架构(在我的例子中,i386 还是 amd64)。
|
||||
* 不同的 Java 版本(就我而言,有 8、11、15、16、17 等)。
|
||||
* 纯粹的 OpenJDK 或无头版本。
|
||||
* Java 运行时环境(JRE)。
|
||||
* 用于调试、演示,以及是否包含源代码等。
|
||||
|
||||
同样,在我的情况中,我主要对纯粹的普通 OpenJDK 感兴趣。
|
||||
|
||||
假设我想为我的 amd64 架构安装 Java 11 版本的普通 OpenJDK,我可以输入:
|
||||
|
||||
```
|
||||
sudo apt install -a=amd64 openjdk-11-jdk
|
||||
```
|
||||
|
||||
几分钟后,我就可以编译、运行、调试和打包我的 Java 代码了。
|
||||
|
||||
注意,很有可能需要同时安装多个版本的 Java,有时甚至是必要的。在 Ubuntu 中,有一个有用的工具,叫做 `update-java-alternatives`,它可以 [显示并配置在使用哪个 Java 环境][3]。
|
||||
|
||||
那些使用不同 Linux 发行版的人,一般来说,可以采取类似的方法。其他的几个发行版(如 Debian 和 Mint)也使用 `apt` ,尽管可用的软件包可能不同。发行版可能使用不同的软件包管理器。例如, [Fedora 安装 Java 的文档页面][4] 显示了如何使用 Fedora `dnf` 包管理器来处理安装。首先,为了显示可用的版本,输入:
|
||||
|
||||
```
|
||||
dnf search openjdk
|
||||
```
|
||||
|
||||
接下来,要安装完整的开发 x86_64 架构版本,请输入:
|
||||
|
||||
```
|
||||
sudo dnf install java-11-openjdk-devel.x86_64
|
||||
```
|
||||
|
||||
同样地,Fedora 提供了 `alternatives` 工具来 [显示和配置 Java 环境][5]。
|
||||
|
||||
再比如,[很棒的 Arch Linux 维基][6] 显示对应的软件包是 `jdk11-openjdk`。该维基还解释了许多在 Arch 中使用 Java 的其他重要细节,比如使用 `archlinux-java` 工具来显示安装了哪些 Java 环境或选择一个不同的默认环境。Arch 使用一个叫 `pacman` 的包管理器,它也有文档 [在 Arch Linux 维基上][7]。
|
||||
|
||||
不管你喜欢哪个发行版和软件包管理器,在你的 Linux 系统上获得 Java 是很容易的。当然,在安装之前,要考虑版本和功能。还要记住,在同一台电脑上有管理两个或多个 Java 版本的方法。我的大多数例子都使用了 `apt`,但也要记得可以选择使用 `dnf`。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/install-java-linux-repositories
|
||||
|
||||
作者:[Chris Hermansen][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/clhermansen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee)
|
||||
[2]: https://openjdk.java.net/
|
||||
[3]: http://manpages.ubuntu.com/manpages/hirsute/man8/update-java-alternatives.8.html
|
||||
[4]: https://docs.fedoraproject.org/en-US/quick-docs/installing-java/
|
||||
[5]: https://tecadmin.net/install-java-on-fedora/
|
||||
[6]: https://wiki.archlinux.org/title/java#OpenJDK
|
||||
[7]: https://wiki.archlinux.org/title/pacman#Querying_package_databases
|
@ -0,0 +1,100 @@
|
||||
[#]: subject: "Dialect: An Open-Source Translation App for Linux"
|
||||
[#]: via: "https://itsfoss.com/dialect/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13868-1.html"
|
||||
|
||||
Dialect:Linux 下的开源翻译应用
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/10/115724t5xgx8agu8asag0u.jpg)
|
||||
|
||||
> Dialect 是一个简单明了的应用,可以让你使用 Web 服务进行语言间的翻译。想要了解更多的话,让我们来一窥究竟。
|
||||
|
||||
虽然你可以启动 Web 浏览器并直接使用任何翻译服务来完成工作,但桌面应用有时会派上用场。
|
||||
|
||||
Dialect 是一个简单的翻译应用,可以利用 Web 服务进行翻译,同时给你一些额外的能力。
|
||||
|
||||
### 使用谷歌翻译和 LibreTranslate 的开源翻译应用
|
||||
|
||||
![][1]
|
||||
|
||||
Dialect 是一个主要为 GNOME 桌面定制的应用,但它在其他桌面环境下也应该能正常工作。
|
||||
|
||||
它可以让你快速翻译语言,同时还有一些额外的选项。
|
||||
|
||||
在其核心部分,你可以选择谷歌翻译或 LibreTranslate 翻译服务。
|
||||
|
||||
尽管 LibreTranslate 达不到谷歌翻译的准确性,但把它作为一个选项来切换是一个很好的补充。至少,对于一些基本的用法,如果用户不想利用谷歌的服务,你的桌面上就有一个备选方案。
|
||||
|
||||
### Dialect 的特点
|
||||
|
||||
![][2]
|
||||
|
||||
除了切换翻译服务外,你还能得到如下个功能:
|
||||
|
||||
* 发音
|
||||
* 文本到语音(TTS)功能(谷歌)
|
||||
* 黑暗模式
|
||||
* 翻译快捷方式
|
||||
* 实时翻译
|
||||
* 剪贴板按钮可快速复制/粘贴
|
||||
* 翻译历史(撤销/重做)
|
||||
|
||||
正如你在截图中所注意到的,实时翻译功能可能会因为滥用 API 而使你的 IP 地址被禁止使用服务。
|
||||
|
||||
![][3]
|
||||
|
||||
我试着使用 LibreTranslate(如上图所示)和谷歌翻译,并启用实时翻译功能,它工作得很好。
|
||||
|
||||
也许,如果你经常依赖翻译,你可能想避免这个实时翻译。但是,对于我的临时使用,在相当多的测试中,该服务并没有导致 IP 地址被禁止。
|
||||
|
||||
重要的是要注意,如果你想,你可以指定一个自定义的 LibreTranslate 实例。默认情况下,它使用 “translate.astian.org” 作为实例。
|
||||
|
||||
你可能找不到一个单独显示的翻译历史区域,但窗口左上角的箭头按钮会让你看到你以前的翻译,以及翻译设置。
|
||||
|
||||
所以,它也可以作为一个重做/撤销的功能。
|
||||
|
||||
### 在 Linux 中安装 Dialect
|
||||
|
||||
[Dialect][7] 是以 [Flatpak][4] 的形式提供的。所以,你应该能够在你选择的任何 Linux 发行版上安装它。如果你是新手,你可能想看看我们的 [Flatpak 指南][5] 以获得帮助。
|
||||
|
||||
首先,添加 Flathub 仓库:
|
||||
|
||||
```
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
```
|
||||
|
||||
然后安装应用:
|
||||
|
||||
```
|
||||
flatpak install flathub com.github.gi_lom.dialect
|
||||
```
|
||||
|
||||
安装后,在系统菜单中寻找它,并从那里启动它。
|
||||
|
||||
你也可以浏览它的 [GitHub 页面][6] 了解更多信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/dialect/
|
||||
|
||||
作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/dialect-screenshot.png?resize=800%2C331&ssl=1
|
||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/dialect-app-options.png?resize=800%2C470&ssl=1
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/dialect-libretranslate.png?resize=800%2C326&ssl=1
|
||||
[4]: https://itsfoss.com/what-is-flatpak/
|
||||
[5]: https://itsfoss.com/flatpak-guide/
|
||||
[6]: https://github.com/dialect-app/dialect/
|
||||
[7]: https://flathub.org/apps/details/com.github.gi_lom.dialect
|
118
published/20210929 Install Java manually on Linux.md
Normal file
118
published/20210929 Install Java manually on Linux.md
Normal file
@ -0,0 +1,118 @@
|
||||
[#]: subject: "Install Java manually on Linux"
|
||||
[#]: via: "https://opensource.com/article/21/9/install-java-manually-linux"
|
||||
[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13869-1.html"
|
||||
|
||||
如何在 Linux 上手动安装 Java
|
||||
======
|
||||
|
||||
> 手动安装可以让用户更好的控制 Java 运行时环境。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/10/143844wm2x4d18b1mb8md1.jpg)
|
||||
|
||||
[使用 Linux 发行版的软件包管理工具来安装 Java 软件包][6] 是很容易的。然而,有时你需要手动安装 Java。这对基于 Java 的应用服务器(如 Tomcat 或 JBoss)的管理员特别重要。许多开源和专有软件产品都依赖于这些服务。
|
||||
|
||||
### 开发者或运行时套件?
|
||||
|
||||
<ruby>Java 虚拟机<rt>Java Virtual Machine</rt></ruby>(JVM)以两种不同的形式提供:<ruby>Java 开发工具包<rt>Java Development Kit</rt></ruby>(JDK)或 <ruby>Java 运行时环境<rt>Java Runtime Environment</rt></ruby>(JRE)。
|
||||
|
||||
软件开发人员通常需要 JDK。它包含编译、运行和测试源代码所需的二进制文件。部署一个预先建立的 Java 应用程序通常只需要 JRE。它不包括编译器和其他开发工具。由于安全性的提高和空间的限制,通常在生产环境中安装 JRE。
|
||||
|
||||
### 获取 Java
|
||||
|
||||
你可以从网上下载开源的 Java 软件。你可以在 [Red Hat Developer][2]、[Adoptium.net][3] 下载 OpenJDK 打包文件,或从 Azul 下载 [Zulu 社区版][4] 。
|
||||
|
||||
### 安装 Java
|
||||
|
||||
设置一个目录来存放 Java 文件。我喜欢创建一个简单的名为 `java` 的目录,这样我就可以在一个专门的目录中下载并解压打包文件:
|
||||
|
||||
```
|
||||
$ mkdir -p java/jdk
|
||||
```
|
||||
|
||||
让我们在这个例子中使用 JDK。将下载的文件保存到 `jdk` 目录下。然后换到该目录:
|
||||
|
||||
```
|
||||
$ cd java/jdk
|
||||
$ ls
|
||||
OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz
|
||||
```
|
||||
|
||||
提取该打包文件。注意,`tar` 会创建一个新的目录:
|
||||
|
||||
```
|
||||
$ tar xvzf OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz
|
||||
$ ls
|
||||
jdk-11.0.12+7 OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz
|
||||
```
|
||||
|
||||
使用 `-version` 选项确认新 JVM 的版本。
|
||||
|
||||
```
|
||||
$ cd jdk-11.0.12+7/bin
|
||||
$ ./java -version
|
||||
```
|
||||
|
||||
JVM 的版本输出看起来类似这样:
|
||||
|
||||
```
|
||||
openjdk version "11.0.12" 2021-07-20
|
||||
OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7)
|
||||
OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)
|
||||
```
|
||||
|
||||
#### 环境变量
|
||||
|
||||
为了确保一个特定的应用程序能够正常工作,它需要确切地知道如何定位 JVM。有两个主要的变量需要设置:`JAVA_HOME` 和 `PATH`。
|
||||
|
||||
```
|
||||
$ echo $JAVA_HOME
|
||||
$ echo $PATH
|
||||
```
|
||||
|
||||
这些可以在用户的 `.bashrc` 文件中设置。确保这些变量出现在 [任何设置 PATH 的现有代码][5] 之后:
|
||||
|
||||
```
|
||||
#Set the JAVA_HOME
|
||||
export JAVA_HOME=~/java/jdk/jdk-11.0.12+7
|
||||
#Add the JAVA_HOME to the PATH
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
```
|
||||
|
||||
### 手动安装的情况
|
||||
|
||||
有几种情况需要手动安装 Java。请考虑以下三种情况:
|
||||
|
||||
一种情况可能是要求使用不同的,也许是较早的,在你的 Linux 发行版的软件库中已经没有的 Java 版本。
|
||||
|
||||
另一个例子可能是由安全推动的决定,即 Java 不会被默认安装在操作系统上或在“根级别”上。
|
||||
|
||||
第三种情况是可能需要几个不同版本的 Java,通常是因为 J2EE Web 应用程序的多个实例在同一台服务器上运行。由于越来越多地使用虚拟机和容器来隔离进程,这种操作系统共享在今天已经不太常见了。然而,由于需要维护不同的容器镜像,对手动安装的理解仍然至关重要。
|
||||
|
||||
### 总结
|
||||
|
||||
我演示了我手动安装 Java 运行时环境的方式,但你可以制定一个最适合你需求的惯例。最终,手动安装让用户可以更好的控制 Java 运行时环境。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/install-java-manually-linux
|
||||
|
||||
作者:[Alan Formy-Duval][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/alanfdoss
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background)
|
||||
[2]: https://developers.redhat.com/products/openjdk/download
|
||||
[3]: https://adoptium.net/
|
||||
[4]: https://www.azul.com/downloads/zulu-community
|
||||
[5]: https://opensource.com/article/17/6/set-path-linux
|
||||
[6]: https://linux.cn/article-13864-1.html
|
154
published/20210930 Make YAML as easy as it looks.md
Normal file
154
published/20210930 Make YAML as easy as it looks.md
Normal file
@ -0,0 +1,154 @@
|
||||
[#]: subject: "Make YAML as easy as it looks"
|
||||
[#]: via: "https://opensource.com/article/21/9/yaml-cheat-sheet"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13842-1.html"
|
||||
|
||||
让 YAML 变得像它看起来一样简单
|
||||
======
|
||||
|
||||
> YAML 看起来很简单,为什么它这么难写呢?了解成功使用 YAML 的两个秘诀。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/02/101824shamurmpvldpu29a.jpg)
|
||||
|
||||
如果你曾经尝试过写 YAML,你可能一开始会对它看起来很容易感到高兴。乍一看,经常用于配置文件、Ansible 剧本和普通文件数据库的 YAML 看起来就像购物清单一样直观。然而,YAML 的结构中有很多细微的差别,它隐藏着一个危险的秘密:YAML 实际上是一种高度精确、结构化和令人惊讶的严格语言。好消息是,你只需要了解两件事就可以知道 YAML 的工作原理。
|
||||
|
||||
关于 YAML 的真相是,YAML 中只有两种数据结构:<ruby>序列<rt>sequence</rt></ruby>和<ruby>映射<rt>mapping</rt></ruby>。这是两个花哨的名字,你会发现它代表了你非常熟悉的概念。这篇文章解释了这两种结构,更重要的是,介绍了它们是如何协同工作,使 YAML 成为表示你所关心的数据的强大方式。
|
||||
|
||||
### YAML 序列
|
||||
|
||||
YAML 序列是一个列表。在其最简单的形式中,每行有一个项目,每行以破折号和空格开始。
|
||||
|
||||
下面是一个例子:
|
||||
|
||||
```
|
||||
---
|
||||
- Linux
|
||||
- BSD
|
||||
- Illumos
|
||||
```
|
||||
|
||||
不同的语言有不同的方式来表示这种数据。例如,在 Python 中,同一个列表可以写成 `['Linux', 'BSD', 'Illumos']`。当你在现实生活中写一个列表时,例如在你去买菜之前,你写的可能近似于 YAML 序列。
|
||||
|
||||
### YAML 映射
|
||||
|
||||
YAML 映射是一个关键术语与该术语的定义相结合。在其他语言中,映射被称为“键值对”或“词典”。
|
||||
|
||||
这里有一个例子:
|
||||
|
||||
```
|
||||
---
|
||||
Kernel: Linux
|
||||
CPU: AMD
|
||||
RAM: '16 GB'
|
||||
```
|
||||
|
||||
不同的语言有不同的方式来表示这种数据。[在 Python 中][2],例如,同样的数据可以写成 `{"Kernel": "Linux", "CPU": "AMD", "RAM": "16 GB"}`。在现实生活中,你可能会使用这种结构来计划,例如,与朋友的游戏之夜。一个朋友报名带零食,另一个报名带一副牌,另一个报名带一个棋盘游戏,等等。
|
||||
|
||||
### 组合序列和映射
|
||||
|
||||
你现在知道 YAML 的语法了。序列和映射是 YAML 中仅有的两种构件,你想在 YAML 中表示的任何东西都可以放在序列或映射中。
|
||||
|
||||
或者同时使用这二者!
|
||||
|
||||
是的,序列和映射可以被组合和嵌套,这就是 YAML 看起来很直观,但同时又感觉很复杂的原因之一。不过,只有四种可能的组合,一旦你学会如何看它们,YAML 就会觉得像它看起来一样简单。
|
||||
|
||||
### 序列的映射
|
||||
|
||||
当你想让一个键项有许多值时,你可以使用一个序列的映射。也就是说,你从一个映射(键)开始,但是给值一个列表:
|
||||
|
||||
```
|
||||
---
|
||||
Linux:
|
||||
- Fedora
|
||||
- Slackware
|
||||
BSD:
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
```
|
||||
|
||||
在这个示例代码中,`Linux` 是第一个键,它的值是一个序列,其中包含 `Fedora` 和 `Slackware`。第二个键是 `BSD`,它的值是一个序列,包含 `FreeBSD` 和 `NetBSD`。
|
||||
|
||||
### 映射的映射
|
||||
|
||||
当你想让一个键项的值中既有键又有值时,你可以使用映射的映射。也就是说,你从一个映射(键)开始,但是给值另一个映射。
|
||||
|
||||
这可能有点欺骗性,但它揭示了 YAML 中使用特定术语的原因:因为你只不过是创建了一个映射的列表,并不意味着你创建了一个序列。这里是一个映射的映射:
|
||||
|
||||
```
|
||||
---
|
||||
Desktop:
|
||||
CPU: RISC-V
|
||||
RAM: '32 GB'
|
||||
Laptop:
|
||||
CPU: AMD
|
||||
RAM: '16 GB'
|
||||
```
|
||||
|
||||
对大多数人来说,这看起来像一个列表。而且从技术上讲,它是一个列表。但重要的是要认识到,它不是 YAML 序列。它是一个映射,其中包含映射。作为半个 YAML 专家,你可以从明显缺少破折号的地方看出区别。
|
||||
|
||||
在 Ansible 剧本的所有结构中,我发现这个结构最容易欺骗人。作为人类,我们喜欢列表,当我们看到一个数据结构 _在字面上_ 是列表时,大多数人会把它当成 YAML 序列。但是在 YAML 中,虽然序列是列表,但是列表并不总是序列。
|
||||
|
||||
### 序列的序列
|
||||
|
||||
就像你可以嵌套映射一样,你可以将一个序列嵌套到一个序列中:
|
||||
|
||||
```
|
||||
---
|
||||
- [Linux, FreeBSD, Illumos]
|
||||
- [YAML, XML, JSON]
|
||||
```
|
||||
|
||||
这可能是我在 YAML 的实际使用中遇到的最不常见的数据结构,但有时你需要一个列表的列表。
|
||||
|
||||
### 映射的序列
|
||||
|
||||
你也可以创建一个包含映射的序列。对于人类排序数据的方式来说,这并不太常见,但对于计算机来说,这可能是一个重要的结构。
|
||||
|
||||
这里有一个例子:
|
||||
|
||||
```
|
||||
---
|
||||
-
|
||||
CPU: AMD
|
||||
RAM: '16 GB'
|
||||
-
|
||||
CPU: Intel
|
||||
RAM: '16 GB'
|
||||
```
|
||||
|
||||
对于 YAML,这可能是最不直观的语法。我发现它在 Python 中呈现时更清晰:
|
||||
|
||||
```
|
||||
[{"CPU": "AMD", "RAM": "16 GB"}, {"CPU": "Intel", "RAM": "16 GB"}]
|
||||
```
|
||||
|
||||
方括号代表一个列表结构,这个列表包含两个字典。每个字典都包含键值对。
|
||||
|
||||
### 构建更好的 YAML
|
||||
|
||||
现在你知道了 YAML 的两个组成部分,以及它们如何被组合起来以表示复杂的数据结构。问题是:你要用 YAML 构建什么?
|
||||
|
||||
和很多人一样,我也使用 YAML 来编写 Ansible 剧本。我还用它作为一种简单的配置格式、作为 D&D 的角色表、表示项目组织所需的目录结构,等等。只要你能适应序列和映射的概念,你会发现 YAML 是一种很容易编写、阅读和(如果有合适的库)解析的格式。
|
||||
|
||||
如果你发现自己经常使用 YAML,请下载我们的 [YAML 速查表][3],以帮助你直观地了解基本数据结构及其组合,并帮助你记住一些额外的语法约定。通过一点点的练习,你会发现 YAML 真的和它看起来一样简单!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/yaml-cheat-sheet
|
||||
|
||||
作者:[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/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
|
||||
[2]: https://opensource.com/article/21/3/dictionary-values-python
|
||||
[3]: https://opensource.com/downloads/yaml-cheat-sheet
|
97
published/20211001 8 reasons why I learned Core Java.md
Normal file
97
published/20211001 8 reasons why I learned Core Java.md
Normal file
@ -0,0 +1,97 @@
|
||||
[#]: subject: "8 reasons why I learned Core Java"
|
||||
[#]: via: "https://opensource.com/article/21/10/why-i-learned-core-java"
|
||||
[#]: author: "Shantam Sahai https://opensource.com/users/shantam-sahai"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13855-1.html"
|
||||
|
||||
学习 Core Java 的 8 个原因
|
||||
======
|
||||
|
||||
> 在学习建立在 Java 之上的所有相关工具时,了解 Core Java 会给你带来很大的优势。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/06/094720iax1d49c5sc0sd48.jpg)
|
||||
|
||||
计算机编程(也被称为 *编码*)的重点不是使用哪种编程语言,而是发展编程逻辑和学习像程序员一样思考。你一开始使用的编程语言应该是在这一努力过程中对你帮助最大的语言。因此,你必须问自己一个问题,“作为一个程序员,你想开发什么?”
|
||||
|
||||
例如,如果你想从事安卓应用开发、视频游戏开发、桌面 GUI 应用,或者只是一般的软件开发,我认为学习 Java 是一个很好的选择。我选择的语言是 Java,它为我提供了一个完整的编程世界。在我居住的印度,Java 程序员的平均工资约为每年 59 万印度卢比(LPA)(根据你的经验,可以高达 100 LPA)。
|
||||
|
||||
不过,Java 是一种庞大的语言,有很多框架和变体可供选择。Core Java 是科技行业发展出来的术语,指的是 Java 语言的中心组件,人们用它来编写框架,并围绕 Java 发展了丰富的产业。我认为,Core Java 是你能获得的最强大的技能之一,因为在学习建立在它之上的所有相关工具时,了解 Java 的基础知识会给你带来巨大的优势。
|
||||
|
||||
以下是我选择 Core Java 的八大理由,我想你也会认可:
|
||||
|
||||
### 1、Java 是一种不断发展的编程语言
|
||||
|
||||
Java 有重要的企业支持,但 Java 开发中最重要的组成部分是 [OpenJDK][2],这是个开源的 Java 开发工具包。OpenJDK 社区以促进和维护开发源码、开放创新和开放标准为使命,致力于改进和维护 Java 及其工具链的开源实现。
|
||||
|
||||
它的每一个版本都会增加创新和便利,使 Java 对开发者和用户都更容易。例如,就在 Java 11 中,他们增加了运行 .java 文件的能力。现在,运行一个单文件的 Java 应用程序所需要的只是 `java` 命令,不需要进行编译:
|
||||
|
||||
```
|
||||
$ java ./hello.java
|
||||
|
||||
Hello world
|
||||
```
|
||||
|
||||
你可以使用 Java 做 Web、移动或桌面的应用程序编程。它是一种高度通用的语言。它有许多有趣的特点,如动态编码、多种安全功能、平台无关的特点和以网络为中心的设计。
|
||||
|
||||
### 2、Java 锚定了安卓应用开发
|
||||
|
||||
你可以使用 Java 来创建安卓用程序。安卓市场巨大,对移动程序员的需求只会越来越大。即使你对成为一个专业的应用程序开发人员不感兴趣,定制你的移动体验的能力也是很强大的,而 Java 使之成为可能。
|
||||
|
||||
而且,这比你想象的要容易得多!学习 Core Java 可以让你轻松地掌握安卓开发工具包或可以输出到移动平台的框架,如 [Processing][3]。
|
||||
|
||||
### 3、丰富的 API 使得 Java 易于使用
|
||||
|
||||
Java 的 API(<ruby>应用编程接口<rt>Application Programming Interface</rt></ruby>)包括类、包、接口等。Java 主要有三种类型的 API:
|
||||
|
||||
* 官方的 Java Core API
|
||||
* 最佳的官方 Java API
|
||||
* 非官方的 API
|
||||
|
||||
API 使编程更容易,因为你可以在不知道其内部实现的情况下构建应用程序。根据我的经验,许多公司喜欢用 Java 而不是其他选择,就是因为 Java API 的力量。
|
||||
|
||||
### 4、开源库
|
||||
|
||||
几乎有无穷无尽的 Java 开源库,包括 Maven、Guava、Apache Commons、Jhipster,等等。你可以复制、学习和分享这些库的资源。它们使编程更容易获得、更快、更便宜,也更有教育意义。
|
||||
|
||||
### 5、Java 有可靠的开发工具
|
||||
|
||||
Java 有一些我最喜欢的 IDE(<ruby>集成开发环境<rt>Integrated Development Environments</rt></ruby>),包括 [Eclipse][4]、[NetBeans][5]、[BlueJ][6] 和 IntelliJ IDEA。它们提供了调试、语法高亮、代码补完、语言支持、自动重构等功能。简而言之,IDE 在 Java 的成功和你在 Java 学习中起着至关重要的作用!
|
||||
|
||||
### 6、印度对 Java 开发人员的需求
|
||||
|
||||
谷歌、Netflix 和 Instagram 等巨头都使用 Java 进行后台开发。印度公司正在积极寻找雇用 Java 程序员来开发安卓应用程序、新的 API 和云上的微服务。这种需求转化为更多的工作机会。
|
||||
|
||||
### 7、Java 有庞大的编程社区
|
||||
|
||||
Java 程序员的社区庞大,囊括了从初学者到专家的所有人。我发现这个社区很热情待人,当你寻求支持的时候,他们会给予帮助。最重要的是,通过参与在线讨论,我学到了大量的新技巧。作为社区的一分子,这是我了解最新趋势、学习更多语言和跟上发展的重要途径。
|
||||
|
||||
### 8、Java 是独立于平台
|
||||
|
||||
Java 是平台无关的,这一点使它具有很高的价值。Java 源代码被编译成字节码,在 Java 虚拟机(JVM)上运行。任何运行 JVM 的平台(支持所有主要平台)都可以运行你的 Java 应用程序。你只需写一次,就可以在任何地方运行!这并不只是理论上的,Java 实际上已经实现了这一点。你可以在你开发的任何平台上编写 Java,并将其交付给你的所有目标平台。
|
||||
|
||||
网上有很多学习 Java 的资源,包括 Opensource.com 上有一个 [速查表][7]。还有一个很好的 [在线 Java 课程][8],可以用印地语免费学习。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/10/why-i-learned-core-java
|
||||
|
||||
作者:[Shantam Sahai][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/shantam-sahai
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/studying-books-java-couch-education.png?itok=C9gasCXr (Learning and studying technology is the key to success)
|
||||
[2]: https://developer.ibm.com/components/open-jdk/
|
||||
[3]: http://processing.org/
|
||||
[4]: https://opensource.com/article/20/12/eclipse
|
||||
[5]: https://opensource.com/article/20/12/netbeans
|
||||
[6]: https://opensource.com/article/20/7/ide-java#bluej
|
||||
[7]: https://opensource.com/downloads/java-cheat-sheet
|
||||
[8]: https://www.learnvern.com/course/core-java-programming-tutorial
|
@ -0,0 +1,128 @@
|
||||
[#]: subject: "The Official Raspberry Pi 4 Case Sucks! Here’s What You Can do to Reduce the Overheating"
|
||||
[#]: via: "https://itsfoss.com/raspberry-pi-case-overheating/"
|
||||
[#]: author: "Avimanyu Bandyopadhyay https://itsfoss.com/author/avimanyu/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13851-1.html"
|
||||
|
||||
官方的树莓派 4 外壳很烂!怎么样减少过热?
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/04/201826ghpecyb43cxehi4y.jpg)
|
||||
|
||||
[树莓派 4][1] 绝对是数百万人的最爱,特别是在极客社区里,我也不例外。但是你知道树莓派在没有适当冷却的情况下会限制性能吗?
|
||||
|
||||
在这里,我将介绍 [树莓派 4 官方外壳][2] 的一些严重缺点,同时也分享一些缓解这些缺点的方法。
|
||||
|
||||
![树莓派 4 官方外壳][3]
|
||||
|
||||
在第一次启动后,我的安装在 [树莓派 4 官方外壳][2] 内的树莓派 4(8GB 内存版),在无人值守的升级启动时,会高达 80℃。我在 Ubuntu 上进行了所有的 [固件更新][4],显然是为了 [解决发热问题][5]。
|
||||
|
||||
就算在空闲时,这个烫手的香草和草莓蛋糕也绝不会低于 75℃。
|
||||
|
||||
我几乎无法使用它,直到我取下外壳顶部的白色盖子。它闲置时的温度降到只有 67℃ 左右 —— 你相信吗?即使是在我重新启动一段时间后再次检查也是这样。很明显,这仍然是不太可接受。如果我买了这个外壳并打算长期使用,我为什么要一直把盖子打开?
|
||||
|
||||
为什么会发生这样的事情?这都是因为官方的树莓派外壳的设计非常糟糕。
|
||||
|
||||
### 官方的树莓派 4 外壳是一个发热怪物!
|
||||
|
||||
简单地说,[热节流][6] 就是降低你的树莓派处理器(CPU)的性能,以使温度不超过极限高温(如 80℃)而 [导致损坏][7]。
|
||||
|
||||
这个外壳是由塑料制成的,它是热的不良导体(简单的 [传统物理学][8] 知识),因此无法将热量有效地散布到整个外壳和板子之外。因此,板上的处理器会发热,一旦温度达到惊人的程度,它的性能就会被降到一个极低的水平。我注意到,在第一次开机后,在**无人值守**的情况下进行升级时,CPU 的温度为 80℃,CPU 的使用率为 100%。
|
||||
|
||||
虽然这个官方的外壳看起来很美,但它对树莓派的性能造成了很大的影响。
|
||||
|
||||
如果你真的想让你的树莓派发挥最大的性能,你也必须负责它的冷却。这些发热问题不能被简单地忽视。
|
||||
|
||||
#### 热量被困在内部
|
||||
|
||||
一旦你把树莓派安装在这个外壳里,它甚至没有一个通风口可以让多余的热量排出。所以热量就一直在里面积累,直到达到那些疯狂的温度并触发了节流阀。
|
||||
|
||||
#### 没有风扇通风口(非常需要)
|
||||
|
||||
顶部的白色盖子上可以有一个圆形的通风口,至少可以把 [树莓派 4 的官方风扇][9] 放在上面使用。
|
||||
|
||||
#### 没有被动冷却
|
||||
|
||||
如果外壳是金属的,它就可以作为散热器,有效地将树莓派板上的处理器的热量散发出去。
|
||||
|
||||
#### 除了发热问题之外,还有其他的缺点
|
||||
|
||||
树莓派 4 官方外壳还有一些缺点:
|
||||
|
||||
1. 不便于 SD 卡管理:将树莓派板子装入外壳内,并将 SD 卡端口放在正确的方向上,以便以后能够换卡,这不是很方便。
|
||||
2. 没有螺丝钉系统:没有提供螺丝,也许是因为它可能会破坏机箱底座上的假支架,这些假支架看起来就像你可以用四颗螺丝把板子牢牢地固定在底座上。
|
||||
|
||||
### 你可以做什么来控制树莓派 4 的过热?
|
||||
|
||||
在做了一些紧张的研究之后,我找到了市场上一些最好的冷却解决方案 —— 这一切都要归功于我们了不起的改装社区。
|
||||
|
||||
#### 使用冰塔式冷却器
|
||||
|
||||
我首先发现了 [Jeff Geerling's][10] 对各种树莓派散热器的深入性能评估,他在网上被称为 [geerlingguy][11]。在看完温度统计后,我直接选择了冰塔式散热器,并组装了它:
|
||||
|
||||
![树莓派 4 冰塔冷却器][12]
|
||||
|
||||
它空闲和低载时的温度下降到 30℃,现在保持在 45℃ 左右。我还没有为它改装一个合适的外壳。我准备找个给冷却器提供了足够的空间的现成外壳。也许可以在亚马逊或其他网上商店找到这种外壳。
|
||||
|
||||
但我没有找到这种产品。
|
||||
|
||||
#### 使用铝制散热器进行被动散热
|
||||
|
||||
网上也有一个关于 [被动冷却][17] 的出色视频,测评了一个用铝制散热片做的外壳。
|
||||
|
||||
它提供了一个热垫,它相当于台式机处理器上使用的散热膏。按照视频中显示的方式放置它,热量就会从树莓派板上的处理器散发到整个外壳内。这就是科学的神奇之处!
|
||||
|
||||
#### 改装官方的树莓派外壳
|
||||
|
||||
如果你仍然想买官方的外壳,建议你至少要做一个风扇的改装。
|
||||
|
||||
### 潜在的制造解决方案
|
||||
|
||||
这里有一些解决方案,通过应用 [DevOps][21] 启发的改进,可以使整个制造过程更容易。
|
||||
|
||||
* 想一想,从外壳顶部切下的那块圆形塑料可以回收,用来制造更多的树莓派 4 外壳,不是吗?这显然会是一个双赢的局面,同时也降低了成本!
|
||||
* 铝是地球上最丰富的金属,但 [全球供应中断][22] 可能是一个挑战。即使如此,还有其他的 [导电性解决方案][23] 来探索用于设计案例的材料!
|
||||
|
||||
### 总结
|
||||
|
||||
希望这篇文章能帮助你从树莓派 4 中获得最大的收益。我很想知道你的想法、建议和经验,请在下面的评论中留言。请不要犹豫地分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/raspberry-pi-case-overheating/
|
||||
|
||||
作者:[Avimanyu Bandyopadhyay][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/avimanyu/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/raspberry-pi-4/
|
||||
[2]: https://www.raspberrypi.org/products/raspberry-pi-4-case/
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/raspberry-pi-4-official-case.webp?resize=800%2C533&ssl=1
|
||||
[4]: https://www.einfochips.com/blog/understanding-firmware-updates-the-whats-whys-and-hows/
|
||||
[5]: https://www.seeedstudio.com/blog/2019/11/29/raspberry-pi-4-firmware-update-pi-4-now-runs-cooler-than-ever/
|
||||
[6]: https://www.pcmag.com/encyclopedia/term/thermal-throttling
|
||||
[7]: https://www.pcgamer.com/cpu-temperature-overheat/
|
||||
[8]: https://thermtest.com/stay-colder-for-longer-in-a-container-made-of-plastic-or-metal
|
||||
[9]: https://www.raspberrypi.org/products/raspberry-pi-4-case-fan/
|
||||
[10]: https://www.jeffgeerling.com/blog/2019/best-way-keep-your-cool-running-raspberry-pi-4
|
||||
[11]: https://www.jeffgeerling.com/about
|
||||
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/raspberry-pi-4-ice-tower-cooler.webp?resize=480%2C360&ssl=1
|
||||
[13]: https://i0.wp.com/m.media-amazon.com/images/I/51g9gQC9k7L._SL160_.jpg?ssl=1
|
||||
[14]: https://www.amazon.com/dp/B07V35SXMC?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (GeeekPi Raspberry Pi Cooling Fan, Raspberry Pi ICE Tower Cooler, RGB Cooling Fan with Raspberry Pi Heatsink for Raspberry Pi 4 Model B & Raspberry Pi 3B+ & Raspberry Pi 3 Model B)
|
||||
[15]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime)
|
||||
[16]: https://www.amazon.com/dp/B07V35SXMC?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)
|
||||
[17]: https://buildabroad.org/2016/11/05/passive-cooling/
|
||||
[18]: https://i2.wp.com/m.media-amazon.com/images/I/41XGLQONCVS._SL160_.jpg?ssl=1
|
||||
[19]: https://www.amazon.com/dp/B07VD568FB?tag=chmod7mediate-20&linkCode=osi&th=1&psc=1 (Geekworm Raspberry Pi 4 Armor Case, Raspberry Pi 4 Computer Model B Armor Aluminum Alloy Passive Cooling Case Compatible with Raspberry Pi 4 Model B Only)
|
||||
[20]: https://www.amazon.com/dp/B07VD568FB?tag=chmod7mediate-20&linkCode=osi&th=1&psc=1 (Buy on Amazon)
|
||||
[21]: https://linuxhandbook.com/what-is-devops/
|
||||
[22]: https://www.reuters.com/article/global-metals-idUSL1N2Q90GA
|
||||
[23]: https://news.mit.edu/2018/engineers-turn-plastic-insulator-heat-conductor-0330
|
104
published/20211002 Monitor your Java on Linux with jconsole.md
Normal file
104
published/20211002 Monitor your Java on Linux with jconsole.md
Normal file
@ -0,0 +1,104 @@
|
||||
[#]: subject: "Monitor your Java on Linux with jconsole"
|
||||
[#]: via: "https://opensource.com/article/21/10/monitor-java-linux-jconsole"
|
||||
[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13860-1.html"
|
||||
|
||||
用 jconsole 在 Linux 上监控你的 Java
|
||||
======
|
||||
|
||||
> 如何使用 Java 开发工具包中的 Java 监控和管理控制台。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/08/131129bf3h3gv18388fl11.jpg)
|
||||
|
||||
Java 开发工具包(JDK)提供了开发 Java 应用程序的二进制文件、工具和编译器。其中一个有用的工具是 `jconsole`。
|
||||
|
||||
为了演示,我将使用 WildFly J2EE 应用服务器,它是 JBOSS 开源应用服务器项目的一部分。首先,我启动了一个独立的实例。
|
||||
|
||||
```
|
||||
~/wildfly/24.0.1/bin$ ./standalone.sh
|
||||
=========================================================================
|
||||
JBoss Bootstrap Environment
|
||||
JBOSS_HOME: /home/alan/wildfly/24.0.1
|
||||
JAVA: /usr/lib/jvm/java-11-openjdk-11.0.11.0.9-5.fc34.x86_64/bin/java
|
||||
```
|
||||
|
||||
现在,在另一个终端,输入 `jconsole`。
|
||||
|
||||
```
|
||||
$ jconsole
|
||||
```
|
||||
|
||||
启动后,jconsole 会列出本地实例。选择“<ruby>本地进程<rt>Local Process</rt></ruby>”,然后选择进程的名称并点击“<ruby>连接<rt>Connect</rt></ruby>”。这就是连接并开始使用运行中的 Java 虚拟机(JVM)的 jconsole 的全部过程。
|
||||
|
||||
![jconsole 与本地进程的新连接屏幕][2]
|
||||
|
||||
### 概述
|
||||
|
||||
这个 Java 监控和管理控制台在仪表板的顶部显示进程标识符(PID)。“<ruby>概述<rt>Overview</rt></ruby>”标签有四个图表,显示“<ruby>堆内存使用情况<rt>Heap Memory Usage</rt></ruby>”、“<ruby>线程<rt>Threads</rt></ruby>”、“<ruby>类<rt>Classes</rt></ruby>”和“<ruby>CPU 使用情况<rt>CPU Usage</rt></ruby>”的重要信息。
|
||||
|
||||
![jconsole 仪表板显示堆内存使用量、线程、类和 CPU 使用量][4]
|
||||
|
||||
沿着顶部的标签提供每个区域的更详细的视图。
|
||||
|
||||
### 内存
|
||||
|
||||
“<ruby>内存<rt>Memory</rt></ruby>”标签显示 JVM 所使用的内存的各个方面的图表。分配给 JVM 的服务器系统内存量被称为“<ruby>堆<rt>Heap</rt></ruby>”。这个屏幕还提供了关于堆的内部组件使用情况的详细信息,例如 “<ruby>伊甸园<rt>Eden Space</rt></ruby>”、“<ruby>老年代<rt>Old Gen</rt></ruby>” 和 “<ruby>幸存者区<rt>Survivor Space</rt></ruby>”。你也可以手动请求一个垃圾收集动作。
|
||||
|
||||
![jconsole 内存标签][5]
|
||||
|
||||
### 线程
|
||||
|
||||
“<ruby>线程<rt>Threads</rt></ruby>”标签显示有多少线程在运行。你也可以手动检查是否存在死锁。
|
||||
|
||||
![jconsole 线程仪表板显示了随时间变化的线程数量和滚动的线程列表][6]
|
||||
|
||||
### 类
|
||||
|
||||
“<ruby>类<rt>Classes</rt></ruby>”标签告诉你有多少类被加载,有多少被卸载。
|
||||
|
||||
![jconsole 类标签显示随着时间推移加载的类数量][7]
|
||||
|
||||
### 虚拟机摘要
|
||||
|
||||
“<ruby>虚拟机摘要<rt>VM Summary</rt></ruby>”标签提供了许多关于应用程序和主机系统的细节。你可以了解你所处的操作系统和架构、系统内存总量、CPU 数量,甚至交换空间。
|
||||
|
||||
![jconsole 虚拟机摘要标签][8]
|
||||
|
||||
摘要中显示的关于 JVM 的进一步细节,包括当前和最大的堆大小以及正在使用的垃圾收集器的信息。底部的窗格列出了传递给 JVM 的所有参数。
|
||||
|
||||
### MBeans
|
||||
|
||||
最后一个标签,MBeans,让你通过所有的 MBeans 向下钻取,以查看每个 MBeans 的属性和值。
|
||||
|
||||
![MBeans 标签][9]
|
||||
|
||||
### 总结
|
||||
|
||||
Java 已经存在了很长时间,它将继续为全球数百万的系统提供动力。有很多开发环境和监控系统可以使用,但像 `jconsole` 这样的包含在基本工具包中的工具非常有价值。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/10/monitor-java-linux-jconsole
|
||||
|
||||
作者:[Alan Formy-Duval][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/alanfdoss
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen)
|
||||
[2]: https://opensource.com/sites/default/files/uploads/jconsole_new_connection_local.png (new connection)
|
||||
[3]: https://creativecommons.org/licenses/by-sa/4.0/deed.ast
|
||||
[4]: https://opensource.com/sites/default/files/uploads/jconsole_tab_overview.png (tab overview)
|
||||
[5]: https://opensource.com/sites/default/files/uploads/jconsole_tab_memory.png (memory tab)
|
||||
[6]: https://opensource.com/sites/default/files/uploads/jconsole_tab_threads.png (threads tab)
|
||||
[7]: https://opensource.com/sites/default/files/uploads/jconsole_tab_classes.png (classes tab)
|
||||
[8]: https://opensource.com/sites/default/files/uploads/jconsole_tab_vm-summary.png (VMsummary tab )
|
||||
[9]: https://opensource.com/sites/default/files/uploads/jconsole_tab_mbeans.png (MBeans tab)
|
364
published/20211005 Tools to explore BGP.md
Normal file
364
published/20211005 Tools to explore BGP.md
Normal file
@ -0,0 +1,364 @@
|
||||
[#]: subject: "Tools to explore BGP"
|
||||
[#]: via: "https://jvns.ca/blog/2021/10/05/tools-to-look-at-bgp-routes/"
|
||||
[#]: author: "Julia Evans https://jvns.ca/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13857-1.html"
|
||||
|
||||
由 Facebook 事故引发的 BGP 工具探索
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202110/07/093743krr8ftrpvgfrvffx.jpg)
|
||||
|
||||
昨天,Facebook 发生了由 BGP 引起的离线事故。我对学习更多关于 BGP 的知识已经隐约感兴趣了很长时间,所以我阅读了一些文章。
|
||||
|
||||
我感到很沮丧,因为没有一篇文章告诉我如何在我的电脑上实际查找与 BGP 有关的信息,因此我 [写了一条询问有关工具的推特][1]。
|
||||
|
||||
我一如既往地得到了一堆有用的回复,所以这篇博文展示了一些你可以用来查询 BGP 信息的工具。这篇文章中可能会有较多的错误,因为我对 BGP 不是很了解。
|
||||
|
||||
### 我不能发布 BGP 路由
|
||||
|
||||
我从来没有了解过 BGP 的原因之一是,据我所知,我没有在互联网上发布 BGP 路由的权限。
|
||||
|
||||
对于大多数网络协议,如果需要,你可以非常轻松地自己实现该协议。例如,你可以:
|
||||
|
||||
* 发行你自己的 TLS 证书
|
||||
* 编写你自己的 HTTP 服务器
|
||||
* 编写你自己的 TCP 实现
|
||||
* 为你的域名编写你自己的权威 DNS 服务器(我现在正在为一个小项目尝试这样做)
|
||||
* 建立你自己的证书机构(CA)
|
||||
|
||||
但是对于 BGP,我认为除非你拥有自己的 ASN,否则你不能自己发布路由(你*可以*在你的家庭网络上实现 BGP,但这对我来说有点无聊,当我做实验的时候,我希望它们真的在真正的互联网上)。
|
||||
|
||||
无论如何,尽管我不能用它做实验,但我仍然认为它超级有趣,因为我喜欢网络,所以我将向你展示我找到的一些用来学习 BGP 的工具。
|
||||
|
||||
首先我们来谈谈 BGP 的一些术语。我打算很快掠过,因为我对工具更感兴趣,而且网上有很多关于 BGP 的高水平解释(比如这篇 [cloudflare 的文章][2])。
|
||||
|
||||
### AS 是什么?
|
||||
|
||||
我们首先需要了解的是 AS(“<ruby>自治系统<rt>autonomous system</rt></ruby>”)。每个 AS:
|
||||
|
||||
1. 由一个组织拥有(通常是一个大型组织,如你的 ISP、政府、大学、Facebook 等)。
|
||||
2. 控制一组特定的 IP 地址(例如,我的 ISP 的 AS 包括 247,808 个 IP 地址)。
|
||||
3. 有一个编号 ASN(如 1403)。
|
||||
|
||||
下面是我通过做一些实验对 AS 的一些观察:
|
||||
|
||||
* 一些相当大的科技公司并没有自己的 AS。例如,我在 BGPView 上查看了 Patreon,就我所知,他们没有自己的 AS,他们的主要网站(`patreon.com`,[104.16.6.49][3])在 Cloudflare 的 AS 中。
|
||||
* 一个 AS 可以包括许多国家的 IP。Facebook 的 AS([AS32934][4])肯定有新加坡、加拿大、尼日利亚、肯尼亚、美国和其他国家的 IP 地址。
|
||||
* 似乎 IP 地址可以在一个以上的 AS 中。例如,如果我查找 [209.216.230.240][5],它有 2 个 ASN 与之相关:`AS6130` 和 `AS21581`。显然,当这种情况发生时,更具体的路线会被优先考虑 —— 所以到该 IP 的数据包会被路由到 `AS21581`。
|
||||
|
||||
### 什么是 BGP 路由?
|
||||
|
||||
互联网上有很多的路由器。例如,我的 ISP 就有路由器。
|
||||
|
||||
当我给我的 ISP 发送一个数据包时(例如通过运行 `ping 129.134.30.0`),我的 ISP 的路由器需要弄清楚如何将我的数据包实际送到 IP 地址 `129.134.30.0`。
|
||||
|
||||
路由器计算的方法是,它有一个**路由表**:这是个有一堆 IP 地址范围的列表(比如 `129.134.30.0/23`),以及它知道的到达该子网的路由。
|
||||
|
||||
下面是一个 `129.134.30.0/23` (Facebook 的一个子网)的真实路由的例子。这不是来自我的 ISP。
|
||||
|
||||
```
|
||||
11670 32934
|
||||
206.108.35.2 from 206.108.35.254 (206.108.35.254)
|
||||
Origin IGP, metric 0, valid, external
|
||||
Community: 3856:55000
|
||||
Last update: Mon Oct 4 21:17:33 2021
|
||||
```
|
||||
|
||||
我认为这是在说通往 `129.134.30.0` 的一条路径是通过机器 `206.108.35.2`,这是在它的本地网络上。所以路由器接下来可能会把我的 ping 包发送到 `206.108.35.2`,然后 `206.108.35.2` 会知道如何把它送到 Facebook。开头的两个数字(`11670 32934`)是 ASN。
|
||||
|
||||
### BGP 是什么?
|
||||
|
||||
我对 BGP 的理解非常浅薄,它是一个公司用来公布 BGP 路由的协议。
|
||||
|
||||
昨天发生在 Facebook 身上的事情基本上是他们发布了一个 BGP 公告,撤销了他们所有的 BGP 路由,所以世界上的每个路由器都删除了所有与 Facebook 有关的路由,没有流量可以到达那里。
|
||||
|
||||
好了,现在我们已经涵盖了一些基本的术语,让我们来谈谈你可以用来查看 AS 和 BGP 的工具吧!
|
||||
|
||||
### 工具 1:用 BGPView 查看你的 ISP 的 AS
|
||||
|
||||
为了使 AS 这个东西不那么抽象,让我们用一个叫做 [BGPView][6]的 工具来看看一个真实的 AS。
|
||||
|
||||
我的 ISP(EBOX)拥有 [AS 1403][7]。这是 [我的 ISP 拥有的 IP 地址][8]。如果我查找我的计算机的公共 IPv4 地址,我可以看到它是我的 ISP 拥有的IP地址之一:它在 `104.163.128.0/17` 块中。
|
||||
|
||||
BGPView 也有这个图,显示了我的 ISP 与其他 AS 的连接情况。
|
||||
|
||||
![][9]
|
||||
|
||||
### 工具 2:traceroute -A 和 mtr -z
|
||||
|
||||
好了,我们感兴趣的是 AS 。让我们看看我从哪些 AS 中穿过。
|
||||
|
||||
`traceroute` 和 `mtr` 都有选项可以告诉你每个 IP 的 ASN。其选项分别是 `traceroute -A` 和 `mtr -z`。
|
||||
|
||||
让我们看看我用 `mtr` 在去 `facebook.com` 的路上经过了哪些 AS!
|
||||
|
||||
```
|
||||
$ mtr -z facebook.com
|
||||
1. AS??? LEDE.lan
|
||||
2. AS1403 104-163-190-1.qc.cable.ebox.net
|
||||
3. AS??? 10.170.192.58
|
||||
4. AS1403 0.et-5-2-0.er1.mtl7.yul.ebox.ca
|
||||
5. AS1403 0.ae17.er2.mtl3.yul.ebox.ca
|
||||
6. AS1403 0.ae0.er1.151fw.yyz.ebox.ca
|
||||
7. AS??? facebook-a.ip4.torontointernetxchange.net
|
||||
8. AS32934 po103.psw01.yyz1.tfbnw.net
|
||||
9. AS32934 157.240.38.75
|
||||
10. AS32934 edge-star-mini-shv-01-yyz1.facebook.com
|
||||
```
|
||||
|
||||
这很有意思,看起来我们直接从我的 ISP 的 AS(`1403`)到 Facebook 的 AS(`32934`),中间有一个“互联网交换”。
|
||||
|
||||
> 我不确定 <ruby>[互联网交换][10]<rt>internet exchange</rt></ruby>(IX)是什么,但我知道它是互联网的一个极其重要的部分。不过这将是以后的事了。我猜是,它是互联网中实现“对等”的部分,就假设它是一个有巨大的交换机的机房,里面有无限的带宽,一堆不同的公司把他们的电脑放在里面,这样他们就可以互相发送数据包。
|
||||
|
||||
#### mtr 用 DNS 查找 ASN
|
||||
|
||||
我对 `mtr` 如何查找 ASN 感到好奇,所以我使用了 `strace`。我看到它看起来像是在使用 DNS,所以我运行了 [dnspeep][11],然后就看到了!
|
||||
|
||||
```
|
||||
$ sudo dnspeep
|
||||
...
|
||||
TXT 1.190.163.104.origin.asn.cymru.com 192.168.1.1 TXT: 1403 | 104.163.176.0/20 | CA | arin | 2014-08-14, TXT: 1403 | 104.163.160.0/19 | CA | arin | 2014-08-14, TXT: 1403 | 104.163.128.0/17 | CA | arin | 2014-08-14
|
||||
...
|
||||
```
|
||||
|
||||
所以,看起来我们可以通过查找 `1.190.163.104.origin.asn.cymru.com` 上的 `txt` 记录找到 `104.163.190.1` 的 ASN,像这样:
|
||||
|
||||
```
|
||||
$ dig txt 1.190.163.104.origin.asn.cymru.com
|
||||
1.190.163.104.origin.asn.cymru.com. 13911 IN TXT "1403 | 104.163.160.0/19 | CA | arin | 2014-08-14"
|
||||
1.190.163.104.origin.asn.cymru.com. 13911 IN TXT "1403 | 104.163.128.0/17 | CA | arin | 2014-08-14"
|
||||
1.190.163.104.origin.asn.cymru.com. 13911 IN TXT "1403 | 104.163.176.0/20 | CA | arin | 2014-08-14"
|
||||
```
|
||||
|
||||
这很好!让我们继续前进吧。
|
||||
|
||||
### 工具 3:数据包交换所的观察镜
|
||||
|
||||
PCH(“<ruby>数据包交换所<rt>packet clearing house</rt></ruby>”)是运行大量互联网交换点的组织。“<ruby>观察镜<rt>looking glass</rt></ruby>”似乎是一个通用术语,指的是让你从另一个人的计算机上运行网络命令的 Web 表单。有一些观察镜不支持 BGP,但我只对那些能显示 BGP 路由信息的观察镜感兴趣。
|
||||
|
||||
这里是 PCH 的观察镜: <https://www.pch.net/tools/looking_glass/> 。
|
||||
|
||||
在该网站的 Web 表单中,我选择了多伦多 IX(“TORIX”),因为 `mtr` 说我是用它来访问 `facebook.com` 的。
|
||||
|
||||
#### 操作 1:显示 ip bgp 摘要
|
||||
|
||||
下面是输出结果。我修改了其中的一些内容:
|
||||
|
||||
```
|
||||
IPv4 Unicast Summary:
|
||||
BGP router identifier 74.80.118.4, local AS number 3856 vrf-id 0
|
||||
BGP table version 33061919
|
||||
RIB entries 513241, using 90 MiB of memory
|
||||
Peers 147, using 3003 KiB of memory
|
||||
Peer groups 8, using 512 bytes of memory
|
||||
|
||||
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
|
||||
...
|
||||
206.108.34.248 4 1403 484672 466938 0 0 0 05w3d03h 50
|
||||
...
|
||||
206.108.35.2 4 32934 482088 466714 0 0 0 01w6d07h 38
|
||||
206.108.35.3 4 32934 482019 466475 0 0 0 01w0d06h 38
|
||||
...
|
||||
|
||||
Total number of neighbors 147
|
||||
```
|
||||
|
||||
我的理解是,多伦多 IX(“TORIX”)直接连接到我的 ISP (EBOX,AS 1403)和 Facebook(AS 32934)。
|
||||
|
||||
#### 操作 2:显示 ip bgp 129.134.30.0
|
||||
|
||||
这是筛选自 `show ip bgp` 对 `129.134.30.0`(Facebook 的一个 IP 地址)的输出:
|
||||
|
||||
```
|
||||
BGP routing table entry for 129.134.30.0/23
|
||||
Paths: (4 available, best #4, table default)
|
||||
Advertised to non peer-group peers:
|
||||
206.220.231.55
|
||||
11670 32934
|
||||
206.108.35.2 from 206.108.35.254 (206.108.35.254)
|
||||
Origin IGP, metric 0, valid, external
|
||||
Community: 3856:55000
|
||||
Last update: Mon Oct 4 21:17:33 2021
|
||||
|
||||
11670 32934
|
||||
206.108.35.2 from 206.108.35.253 (206.108.35.253)
|
||||
Origin IGP, metric 0, valid, external
|
||||
Community: 3856:55000
|
||||
Last update: Mon Oct 4 21:17:31 2021
|
||||
|
||||
32934
|
||||
206.108.35.3 from 206.108.35.3 (157.240.58.225)
|
||||
Origin IGP, metric 0, valid, external, multipath
|
||||
Community: 3856:55000
|
||||
Last update: Mon Oct 4 21:17:27 2021
|
||||
|
||||
32934
|
||||
206.108.35.2 from 206.108.35.2 (157.240.58.182)
|
||||
Origin IGP, metric 0, valid, external, multipath, best (Older Path)
|
||||
Community: 3856:55000
|
||||
Last update: Mon Oct 4 21:17:27 2021
|
||||
```
|
||||
|
||||
这似乎是在说,从该 IX 到 Facebook 有 4 条路线。
|
||||
|
||||
**魁北克 IX 似乎对 Facebook 一无所知**。
|
||||
|
||||
我也试过从魁北克 IX(“QIX”,它可能离我更近,因为我住在蒙特利尔而不是多伦多)做同样的事情。但 QIX 似乎对 Facebook 一无所知:当我输入`129.134.30.0` 时,它只是说 “% 网络不在表中”。
|
||||
|
||||
所以我想这就是为什么我被送到多伦多 IX 而不是魁北克的 IX。
|
||||
|
||||
#### 更多的 BGP 观察镜
|
||||
|
||||
这里还有一些带观察镜的网站,可以从其他角度给你类似的信息。它们似乎都支持相同的 `show ip bgp` 语法,也许是因为他们运行的是同一个软件?我不太确定。
|
||||
|
||||
* <http://www.routeviews.org/routeviews/index.php/collectors/>
|
||||
* <http://www.routeservers.org/>
|
||||
* <https://lg.he.net/>
|
||||
|
||||
似乎有很多这样的观察镜服务,远不止这 3 个列表。
|
||||
|
||||
这里有一个与这个列表上的一个服务器进行会话的例子:`route-views.routeviews.org`。这次我是通过 telnet 连接的,而不是通过 Web 表单,但输出的格式看起来是一样的。
|
||||
|
||||
```
|
||||
$ telnet route-views.routeviews.org
|
||||
|
||||
route-views>show ip bgp 31.13.80.36
|
||||
|
||||
BGP routing table entry for 31.13.80.0/24, version 1053404087
|
||||
Paths: (23 available, best #2, table default)
|
||||
Not advertised to any peer
|
||||
Refresh Epoch 1
|
||||
3267 1299 32934
|
||||
194.85.40.15 from 194.85.40.15 (185.141.126.1)
|
||||
Origin IGP, metric 0, localpref 100, valid, external
|
||||
path 7FE0C3340190 RPKI State valid
|
||||
rx pathid: 0, tx pathid: 0
|
||||
Refresh Epoch 1
|
||||
6939 32934
|
||||
64.71.137.241 from 64.71.137.241 (216.218.252.164)
|
||||
Origin IGP, localpref 100, valid, external, best
|
||||
path 7FE135DB6500 RPKI State valid
|
||||
rx pathid: 0, tx pathid: 0x0
|
||||
Refresh Epoch 1
|
||||
701 174 32934
|
||||
137.39.3.55 from 137.39.3.55 (137.39.3.55)
|
||||
Origin IGP, localpref 100, valid, external
|
||||
path 7FE1604D3AF0 RPKI State valid
|
||||
rx pathid: 0, tx pathid: 0
|
||||
Refresh Epoch 1
|
||||
20912 3257 1299 32934
|
||||
212.66.96.126 from 212.66.96.126 (212.66.96.126)
|
||||
Origin IGP, localpref 100, valid, external
|
||||
Community: 3257:8095 3257:30622 3257:50001 3257:53900 3257:53904 20912:65004
|
||||
path 7FE1195AF140 RPKI State valid
|
||||
rx pathid: 0, tx pathid: 0
|
||||
Refresh Epoch 1
|
||||
7660 2516 1299 32934
|
||||
203.181.248.168 from 203.181.248.168 (203.181.248.168)
|
||||
Origin IGP, localpref 100, valid, external
|
||||
Community: 2516:1030 7660:9001
|
||||
path 7FE0D195E7D0 RPKI State valid
|
||||
rx pathid: 0, tx pathid: 0
|
||||
```
|
||||
|
||||
这里有几个路由的选择:
|
||||
|
||||
* `3267 1299 32934`
|
||||
* `6939 32934`
|
||||
* `701 174 32934`
|
||||
* `20912 3257 1299 32934`
|
||||
* `7660 2516 1299 32934`
|
||||
|
||||
我想这些都有不止一个 AS 的原因是,`31.13.80.36` 是 Facebook 在多伦多的 IP 地址,所以这个服务器(可能在美国西海岸,我不确定)不能直接连接到它,它需要先到另一个 AS。所以所有的路由都有一个或多个 ASN。
|
||||
|
||||
最短的是 `6939`(“Hurricane Electric”),它是一个 “全球互联网骨干”。他们也有自己的 [Hurricane Electric 观察镜][12] 页面。
|
||||
|
||||
### 工具 4:BGPlay
|
||||
|
||||
到目前为止,所有其他的工具都只是向我们展示了 Facebook 路由的当前状态,其中一切正常,但这第四个工具让我们看到了这个 Facebook BGP 互联网灾难的历史。这是一个 GUI 工具,所以我将包括一堆屏幕截图。
|
||||
|
||||
该工具在 <https://stat.ripe.net/special/bgplay>。我输入了 IP 地址 `129.134.30.12`(Facebook 的一个 IP),如果你想一起试试。
|
||||
|
||||
首先,让我们看看一切出错之前的状态。我点击了在 10 月 4 日 13:11:28 的时间线,得到了这个结果:
|
||||
|
||||
![][13]
|
||||
|
||||
我最初发现这很让人不知所措。发生了什么事?但后来有人在推特上指出,下一个要看的地方是点击 Facebook 灾难发生后的时间线(10 月 4 日 18 点 38 分)。
|
||||
|
||||
![][14]
|
||||
|
||||
很明显,这张图有问题:所有的 BGP 路线都不见了!哦,不要!
|
||||
|
||||
顶部的文字显示了最后一条 Facebook BGP 路由的消失:
|
||||
|
||||
```
|
||||
Type: W > withdrawal Involving: 129.134.30.0/24
|
||||
Short description: The route 50869, 25091, 32934 has been withdrawn.
|
||||
Date and time: 2021-10-04 16:02:33 Collected by: 20-91.206.53.12
|
||||
```
|
||||
|
||||
如果我再点击“<ruby>快进<rt>fast forward</rt></ruby>”按钮,我们看到 BGP 路由开始回来了。
|
||||
|
||||
![][15]
|
||||
|
||||
第一个宣告的是 `137409 32934`。但我不认为这实际上是第一个宣布的,在同一秒内有很多路由宣告(在 2021-10-04 21:00:40),我认为 BGPlay 内部的排序是任意的。
|
||||
|
||||
如果我再次点击“<ruby>快进<rt>fast forward</rt></ruby>”按钮,越来越多的路由开始回来,路由开始恢复正常。
|
||||
|
||||
我发现在 BGPlay 里看这个故障真的很有趣,尽管一开始界面很混乱。
|
||||
|
||||
### 也许了解一下 BGP 是很重要的?
|
||||
|
||||
我在这篇文章的开头说,你不能改变 BGP 路由,但后来我想起在 2016 年或 2017 年,有一个 [Telia 路由问题][16],给我们的工作造成了一些小的网络问题。而当这种情况发生时,了解为什么你的客户无法到达你的网站其实是很有用的,即使它完全不受你控制。当时我不知道这些工具,但我希望能知道!
|
||||
|
||||
我认为对于大多数公司来说,应对由其他人的错误 BGP 路由造成的中断,你所能做的就是“什么都不做,等待它得到修复”,但能够_自信地_什么都不做是很好的。
|
||||
|
||||
### 一些发布 BGP 路由的方法
|
||||
|
||||
如果你想(作为一个业余爱好者)真正发布 BGP 路由,这里有一些评论中的链接:
|
||||
|
||||
* [获取你自己的 ASN 的指南][17]
|
||||
* [dn42][18] 似乎有一个 BGP 的实验场(它不在公共互联网上,但确实有其他人在上面,这似乎比自己在家里做 BGP 实验更有趣)
|
||||
|
||||
### 目前就这些了
|
||||
|
||||
我想还有很多 BGP 工具(比如 PCH 有一堆 [路由数据的每日快照][19],看起来很有趣),但这篇文章已经很长了,而且我今天还有其他事情要做。
|
||||
|
||||
我对我作为一个普通人可以得到这么多关于 BGP 的信息感到惊讶,我一直认为它是一个“秘密的网络巫师”这样的东西,但显然有各种公共机器,任何人都可以直接 telnet 到它并用来查看路由表!没想到!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2021/10/05/tools-to-look-at-bgp-routes/
|
||||
|
||||
作者:[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/1445199475195236356
|
||||
[2]: https://blog.cloudflare.com/october-2021-facebook-outage/
|
||||
[3]: https://bgpview.io/ip/104.16.6.49
|
||||
[4]: https://bgpview.io/asn/32934#prefixes-v4
|
||||
[5]: https://bgpview.io/ip/209.216.230.240
|
||||
[6]: https://bgpview.io
|
||||
[7]: https://bgpview.io/asn/1403
|
||||
[8]: https://bgpview.io/asn/1403#prefixes-v4
|
||||
[9]: https://jvns.ca/images/ebox-graph.png
|
||||
[10]: https://en.wikipedia.org/wiki/Internet_exchange_point
|
||||
[11]: https://github.com/jvns/dnspeep/
|
||||
[12]: https://lg.he.net/
|
||||
[13]: https://jvns.ca/images/bgplay-before.png
|
||||
[14]: https://jvns.ca/images/bgplay-after.png
|
||||
[15]: https://jvns.ca/images/bgplay-return.png
|
||||
[16]: https://news.ycombinator.com/item?id=14246888
|
||||
[17]: https://labs.ripe.net/author/samir_jafferali/build-your-own-anycast-network-in-nine-steps/
|
||||
[18]: https://dn42.eu/Home
|
||||
[19]: https://www.pch.net/resources/Routing_Data/IPv4_daily_snapshots/
|
@ -0,0 +1,94 @@
|
||||
[#]: subject: "DirectX 11/12 Games like Cyberpunk 2077 Can Use NVIDIA DLSS With Proton Experimental on Linux"
|
||||
[#]: via: "https://news.itsfoss.com/nvidia-dlss-dx-11-12-proton/"
|
||||
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13865-1.html"
|
||||
|
||||
《赛博朋克 2077》等 DirectX 11/12 游戏可在 Linux 上体验 DLSS 了
|
||||
======
|
||||
|
||||
> 通过 Steam Proton 的实验版本,期待已久的 Nvidia DLSS 支持在 Linux 上的 DirectX 11/12 大作中出现。
|
||||
|
||||
![](https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/10/nvidia-dlss-proton.png?w=1200&ssl=1)
|
||||
|
||||
6 月,英伟达 [宣布][1] 通过 Steam Proton 支持 Linux 中的 DLSS,并为基于 Vulkan 的游戏提供了测试版驱动程序。
|
||||
|
||||
DLSS 是指<ruby>深度学习超级采样<rt>Deep Learning Super Sampling</rt></ruby>。它利用由 RTX GPU 中的 Tensor 核心提供支持的深度学习算法来提升游戏中的图像。这将使图像更清晰、更锐利,并提高帧率。
|
||||
|
||||
![来源:英伟达][2]
|
||||
|
||||
这种 [升级技术][3] 类似于 AMD 的 Fidelity FX,甚至更接近于英特尔即将推出的 XeSS,与 DLSS 不同的是这两者都是开源的。玩家已经可以通过 [GloriousEggroll][4] 的定制 Proton GE 版本体验到 Fidelity FX。
|
||||
|
||||
此外,英伟达还计划在今年秋天之前将支持范围扩大到 DirectX 游戏。
|
||||
|
||||
而且,随着最新的 Proton 实验性支持,这一切终于实现了。使用英伟达 GPU 的 Linux 游戏玩家现在可以用 DLSS 玩他们最喜欢的基于 DX11/12 的游戏。
|
||||
|
||||
考虑到我们很快就能在 Linux 上玩各种多人游戏,并且 [Proton 中添加了对 BattleEye & Easy-Anti Cheat 的支持][5],这是进行这项添加的最好时机。
|
||||
|
||||
### Steam Porton 的重大更新
|
||||
|
||||
几天前,伴随着 Proton 6.3-7 的一波改进,Valve 终于设法将 DLSS 支持添加到 Proton 的 DirectX 11/12 游戏实验分支中。
|
||||
|
||||
在此之前,需要一个测试版驱动程序才能将 DLSS 用于基于 Vulkan 的游戏,例如 DOOM Eternal。
|
||||
|
||||
但是,现在不再如此 —— 尽管推荐使用最新的驱动程序。
|
||||
|
||||
作为补充,DXVK 和 Steamworks SDK 也已经更新到最新的开发版本。此外,还修复了特定游戏的性能问题和其他错误。
|
||||
|
||||
你可以查看 Proton 的 [官方 GitHub 更新日志][6] 来了解到目前为止支持的所有游戏的改进列表。
|
||||
|
||||
### 为 DX11/12 游戏启用 DLSS
|
||||
|
||||
启用 DLSS 是一个简单明了的过程。
|
||||
|
||||
首先,你必须确保你的 Windows 游戏可以在 Proton Experimental 上运行。
|
||||
|
||||
这可以通过右键点击游戏并选择“<ruby>属性<rt>Properties</rt></ruby>”来完成。然后在“<ruby>兼容性<rt>Compatibility</rt></ruby>”下,你需要勾选“<ruby>强制使用特定的 Steam Play 兼容工具<rt>Force the use of a specific Steam Play compatibility tool</rt></ruby>”复选框。接下来,从下拉菜单中选择 “Proton Experimental”。
|
||||
|
||||
![][7]
|
||||
|
||||
最后,你需要在“<ruby>启动选项<rt>Launch Options</rt></ruby>”中插入命令:`PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 %command%` 。
|
||||
|
||||
![][8]
|
||||
|
||||
这就行了。你就可以用 DLSS 玩你的游戏了!
|
||||
|
||||
### 总结
|
||||
|
||||
英伟达 DLSS 对于许多游戏来说是一个非常需要的功能,因为它的作用很大。
|
||||
|
||||
Linux 从一开始就没有对 DLSS 的全面支持。但是,看起来它很快就会在未来的 Proton 稳定版本中提供,并进行必要的改进。
|
||||
|
||||
Linux 玩家终于可以用基于 RTX 的 GPU 在许多游戏中体验到更好的帧率和视觉质量。
|
||||
|
||||
虽然我在 AMD 显卡上使用 Fidelity FX,但我仍然渴望在 RTX GPU 上尝试 DLSS!
|
||||
|
||||
你对英伟达 DLSS 的到来有什么感觉?你会很快尝试它吗?欢迎在下面分享你的评论。
|
||||
|
||||
转自:[GamingOnLinux][9]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/nvidia-dlss-dx-11-12-proton/
|
||||
|
||||
作者:[Rishabh Moharir][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://news.itsfoss.com/author/rishabh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.nvidia.com/en-us/geforce/news/june-2021-rtx-dlss-game-update/
|
||||
[2]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/10/DLSS_RDD2.jpg?w=800&ssl=1
|
||||
[3]: https://news.itsfoss.com/intel-xess-open-source/
|
||||
[4]: https://github.com/GloriousEggroll/proton-ge-custom
|
||||
[5]: https://news.itsfoss.com/easy-anti-cheat-linux/
|
||||
[6]: https://github.com/ValveSoftware/Proton/wiki/Changelog
|
||||
[7]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/10/Compatibility.png?w=836&ssl=1
|
||||
[8]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/10/Commands-1.png?w=831&ssl=1
|
||||
[9]: https://www.gamingonlinux.com/2021/10/proton-experimental-expands-nvidia-dlss-support-on-linux-to-directx-11-titles
|
@ -1,103 +0,0 @@
|
||||
[#]: subject: "Open-Source Frontend for Emulators “RetroArch” Now Available on Steam for Windows and Linux Users"
|
||||
[#]: via: "https://news.itsfoss.com/retroarch-steam/"
|
||||
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Open-Source Frontend for Emulators “RetroArch” Now Available on Steam for Windows and Linux Users
|
||||
======
|
||||
|
||||
Since its release way back in 2010, [RetroArch][1] has been one of the most popular game emulator interfaces. Over the years, it has received numerous upgrades and lets you play classic games from various retro consoles ranging from the Atari 2600 to the PlayStation 2.
|
||||
|
||||
While the RetroArch team has been planning to launch this on Steam for more than a year, it is finally available to the masses!
|
||||
|
||||
This means you can now emulate and play your favorite retro games without having to leave Steam.
|
||||
|
||||
Sure, you can download it from their official website, but launching it directly from your Steam collection proves to be a hassle-free way for most users.
|
||||
|
||||
Not to forget, RetroArch’s presence on Steam will put this on a lot of people’s radars. So, this should give RetroArch’s popularity a boost on both Windows and Linux platforms.
|
||||
|
||||
![RetroArch on Steam][2]
|
||||
|
||||
Keep in mind that the RetroArch version available on Steam lacks certain features and most cores compared to the official one. Let us take a look at them.
|
||||
|
||||
### Key Highlights
|
||||
|
||||
#### Emulator Cores
|
||||
|
||||
Unlike the standard way of using the _Core Downloader_, Cores (Emulators) can be installed as **DLCs** from Steam. This can be easily done by navigating to **“Manage DLC”** on Steam’s Retroarch browser page.
|
||||
|
||||
Only 10 cores are available at launch. Here’s the list of cores –
|
||||
|
||||
* Mupen64 Plus Next – Nintendo N64
|
||||
* Kronos – Sega Saturn
|
||||
* PCSX ReARMed – PlayStation 1
|
||||
* Stella – Atari 2600
|
||||
* SameBoy – Game Boy & Game Boy Colour
|
||||
* mGBA – Game Boy Advance
|
||||
* Mesen – Nintendo Entertainment System
|
||||
* Mesen S – Super Nintendo Entertainment System
|
||||
* Genesis Plus GX – Sega SG-1000, Master System, Game Gear, Genesis and Mega CD
|
||||
* Final Burn Neo – Arcade
|
||||
|
||||
|
||||
|
||||
Additional cores will certainly be released in the future. According to the developer:
|
||||
|
||||
> More cores will be coming as DLC soon. We have no ETA on when these will arrive, but it will likely be a dripfeed of new cores on a periodic basis as it takes a lot of time preparing the pages, descriptions, logos, previews and whatnot that a Steam page requires.
|
||||
|
||||
RetroArch Blog
|
||||
|
||||
![Retroarch Main Menu \(Source: Retroarch\)][3]
|
||||
|
||||
#### Other Highlights
|
||||
|
||||
RetroArch UI stays the same. This may be overwhelming for users who will be using RetroArch for the first time. The developers have plans to revamp its UI soon enough.
|
||||
|
||||
Remote Play and Steam Cloud sync should also work.
|
||||
|
||||
Do note that RetroArch will only be available for 64-bit Linux or Windows PCs. As of now, there are no plans for macOS yet.
|
||||
|
||||
You can learn more about RetroArch’s availability on Steam on their [official blog post][4].
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
The addition of RetroArch to Steam will certainly increase their userbase. Initial reviews seem to be very positive, which is a good thing!
|
||||
|
||||
They should get better financial support from new users on [Patreon][5] as well. You might as well start helping them out if interested.
|
||||
|
||||
If you want to try it out, head to your Steam client and search for it. Or, click on the link below to explore it on Steam store along with its system requirements.
|
||||
|
||||
[RetroArch on Steam][6]
|
||||
|
||||
**Via**: [GamingOnLinux][7]
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/retroarch-steam/
|
||||
|
||||
作者:[Rishabh Moharir][a]
|
||||
选题:[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/rishabh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.retroarch.com/
|
||||
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM3NSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQyOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[4]: https://www.libretro.com/index.php/retroarch-finally-released-on-steam/
|
||||
[5]: https://www.patreon.com/libretro
|
||||
[6]: https://store.steampowered.com/app/1118310/RetroArch/
|
||||
[7]: https://www.gamingonlinux.com/2021/09/retroarch-gets-a-steam-release-bringing-emulation-to-even-more-gamers
|
@ -1,86 +0,0 @@
|
||||
[#]: subject: "After Chromium, Ubuntu Now Converts Firefox to Snap by Default"
|
||||
[#]: via: "https://news.itsfoss.com/ubuntu-firefox-snap-default/"
|
||||
[#]: author: "Abhishek https://news.itsfoss.com/author/root/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
After Chromium, Ubuntu Now Converts Firefox to Snap by Default
|
||||
======
|
||||
|
||||
One of the major and controversial [changes in the upcoming Ubuntu 21.10][1] is the conversion of Firefox from deb to snap.
|
||||
|
||||
Yes, you heard it right. The default Firefox will be a Snap application, not the regular DEB version.
|
||||
|
||||
As [spotted by OMG! Ubuntu][2], this is done as per an agreement between Mozilla and Canonical (Ubuntu’s parent company).
|
||||
|
||||
The [feature freeze exception (FFE)][3] mentions it clearly:
|
||||
|
||||
> Per Canonical’s distribution agreement with Mozilla, we’re making the snap the default installation of Firefox on desktop ISOs starting with Ubuntu 21.10.
|
||||
|
||||
With this change, the Firefox deb package will be converted to Firefox snap package.
|
||||
|
||||
This means that going forward, Firefox will be available as Snap. I think this change also means that even if you use apt command to install it, you’ll be getting the Snap package.
|
||||
|
||||
### Deja vu?
|
||||
|
||||
If you feel that this has been done in the past, you have got the right feeling. In the past, Ubuntu converted the Chromium browser to Snap.
|
||||
|
||||
Today, if you use apt install chromium-browser, you still get the Snap version. There is no DEB package for Chromium in Ubuntu anymore.
|
||||
|
||||
When Ubuntu made this sudden change on its own, there was an uproar. The conversion of Firefox to Snap will also create controversy. But this time, Ubuntu shares the blame with Mozilla.
|
||||
|
||||
### Mozilla wants Snap
|
||||
|
||||
![][4]
|
||||
|
||||
Interestingly, it was [Mozilla that approached Canonical for this change][5]. Mozilla will maintain the Snap version of Firefox and the end users will get quick updates directly from the source.
|
||||
|
||||
After all, it takes a few days before a new Firefox release lands in Ubuntu. With the Snap move, your Firefox will be updated to the new version the same day.
|
||||
|
||||
### Concerns?
|
||||
|
||||
A few for sure. I know there are a few people completely averted to Snap, I am not one of them.
|
||||
|
||||
I have three major complaints with Snap packages: slow start up speed, poor system integration and high disk space.
|
||||
|
||||
Over the time, Snaps have improved on the disk space front. But despite all the improvements, Snap packages still take longer to start. This could be tolerable with an IDE but it may ruin the browsing experience.
|
||||
|
||||
This slow startup speed makes me wonder why it is called ‘Snap’ because surely, it doesn’t start in a snap.
|
||||
|
||||
Another thing that bothers me is the Snap auto-refresh. Snap apps are updated automatically. If Mozilla starts pushing updates more frequently, this [Firefox restart annoyance][6] in the middle of work will be more frequently as well.
|
||||
|
||||
![][7]
|
||||
|
||||
The change will impact you when you install or upgrade to Ubuntu 21.10. The change will eventually propagate to Ubuntu 22.04 LTS.
|
||||
|
||||
What do you think of this change? Yeah or neah?
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/ubuntu-firefox-snap-default/
|
||||
|
||||
作者:[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://news.itsfoss.com/ubuntu-21-10-release-schedule/
|
||||
[2]: https://www.omgubuntu.co.uk/2021/09/ubuntu-makes-firefox-snap-default
|
||||
[3]: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1943840
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1NCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[5]: https://discourse.ubuntu.com/t/feature-freeze-exception-seeding-the-official-firefox-snap-in-ubuntu-desktop/24210
|
||||
[6]: https://news.itsfoss.com/mozilla-annoying-new-tab/
|
||||
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjMwOCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
@ -1,65 +0,0 @@
|
||||
[#]: subject: "Linux Mint’s Website Has a Much Needed Minty Fresh New Look"
|
||||
[#]: via: "https://news.itsfoss.com/linux-mint-new-website-design/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Linux Mint’s Website Has a Much Needed Minty Fresh New Look
|
||||
======
|
||||
|
||||
Linux Mint is one of the [best Linux distributions][1] available while offering a modern user experience.
|
||||
|
||||
However, Linux Mint’s original website looked dated and potentially unattractive to new-age computer users.
|
||||
|
||||
Many suggested a visual makeover to reflect Linux Mint’s taste through a modern website design. And, only recently the developers started working on a redesign in collaboration with the community members, asking for feedback and getting insights on proposed designs.
|
||||
|
||||
Finally, a design was finalized and applied to [Linux M][2][i][2][nt’s official website][2].
|
||||
|
||||
The website looks clean and informative, great on desktop, and perfectly fits mobile phone browsers!
|
||||
|
||||
![][3]
|
||||
|
||||
Every new Linux user should be able to evaluate their requirements by looking at the features offered easily.
|
||||
|
||||
The information is well-presented to convince users why they should try out Linux Mint on their desktop system.
|
||||
|
||||
![][4]
|
||||
|
||||
The key highlights of the website would be the homepage, download page, and donation page.
|
||||
|
||||
Of course, you can choose to explore more about Linux Mint and how everything works through individual resources (like our articles), but the official website should be the essential starting point, which it is now.
|
||||
|
||||
The accent color and the theme combination feels just like what Linux Mint needed! Navigating through various web pages and the menu is a breeze. I don’t think there is any unnecessary element on the website; everything fits perfectly in the first look. The page load time is faster as well.
|
||||
|
||||
The blog/monthly news section continues to use the same design. And, I’m not certain if they intend to refresh that by applying the same design anytime soon. But, I think that should happen to ensure consistency between their web pages.
|
||||
|
||||
_What do you think about Linux Mint’s new website design? Do you like it? Do you think this would help them get more attention from new-age users?_
|
||||
|
||||
_You are welcome to share your thoughts in the comments down 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/linux-mint-new-website-design/
|
||||
|
||||
作者:[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/best-linux-distributions/
|
||||
[2]: https://linuxmint.com
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUzOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUzMSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
@ -1,80 +0,0 @@
|
||||
[#]: subject: "Ubuntu Touch OTA-19 Brings in Support for New Devices With Multiple Bug Fixes"
|
||||
[#]: via: "https://news.itsfoss.com/ubuntu-touch-ota-19/"
|
||||
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Ubuntu Touch OTA-19 Brings in Support for New Devices With Multiple Bug Fixes
|
||||
======
|
||||
|
||||
Ubuntu Touch is an open-source OS for mobile devices that respects user privacy, unlike Google’s Android for privacy-focused users. The UBports community has released yet another update of Ubuntu Touch that is based on Ubuntu 16.04.
|
||||
|
||||
This release supports many new devices and contains significant updates on certain phones, along with numerous bug fixes.
|
||||
|
||||
Let’s take a look at them.
|
||||
|
||||
![Source: UBports][1]
|
||||
|
||||
### What’s New?
|
||||
|
||||
#### Framework and Packages
|
||||
|
||||
The 16.04.7 Qt framework and packages like qml-module-qtwebview and libqt5webview5-dev have been added to the App framework. This improves application compatibility with other platforms.
|
||||
|
||||
#### Imrpovements to Halium devices
|
||||
|
||||
The gyroscope and magnetic field sensors can now be accessed on the Halium 5.1 and 7.1 devices. Do note that the functionality of the compass is still under development. The same applies to the magnetic field sensor for the Halium 9 and 10 devices that now use sensorfw, thus replacing the legacy platform-API.
|
||||
|
||||
#### Pixel 3a
|
||||
|
||||
You can completely shut down the device as intended. It no longer hangs in the process of the shutdown, so you should have better battery life. Additionally, the freezing of the camera app while capturing sounds when recording videos has also been fixed.
|
||||
|
||||
#### Messaging App Fix
|
||||
|
||||
The messaging app has also received a minor update. When messages arrive, the keyboard will no longer appear automatically but when needed. This is useful if the user doesn’t want to reply or access the keyboard on demand.
|
||||
|
||||
#### Media Hub
|
||||
|
||||
A bug that prevented the device from sleep when audio sounds were played in successions has been fixed. Another major bug that reduced battery life drastically, because of uncleared requested wake locks, has also been taken care of.
|
||||
|
||||
### Other Improvements
|
||||
|
||||
There are several new devices added to support Ubuntu Touch, along with fixes for the Wi-Fi, audio, and camera.
|
||||
|
||||
You can look at the [official release notes][2] to check the list of devices added and explore more technical details.
|
||||
|
||||
### Update or Installation
|
||||
|
||||
Ubuntu Touch users should automatically receive an update or head to the updates in the System Settings to check for available updates.
|
||||
|
||||
Those willing to try out Ubuntu Touch for the first time can explore the [official website][3] and check if their device is supported correctly before installation.
|
||||
|
||||
I am particularly looking forward to the Ubuntu Touch OS update with Ubuntu 18.04 or newer as its base after several minor updates.
|
||||
|
||||
_What do you think about this new update? Have you tried it yet?_
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/ubuntu-touch-ota-19/
|
||||
|
||||
作者:[Rishabh Moharir][a]
|
||||
选题:[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/rishabh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQyMiIgd2lkdGg9IjM0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: https://ubports.com/blog/ubports-news-1/post/ubuntu-touch-ota-19-release-3779
|
||||
[3]: https://ubuntu-touch.io/get-ubuntu-touch
|
@ -1,86 +0,0 @@
|
||||
[#]: subject: "Brave Launches Privacy-Focused “Brave Talk” as a Desperate Attempt to Push Brave Advertisements"
|
||||
[#]: via: "https://news.itsfoss.com/brave-talk/"
|
||||
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Brave Launches Privacy-Focused “Brave Talk” as a Desperate Attempt to Push Brave Advertisements
|
||||
======
|
||||
|
||||
Ever since the initial Covid-19 outbreak in 2020, the world has seen an explosion in the popularity of online meeting services. Unfortunately, many of these are not very privacy-friendly, especially as many of these are offered by notoriously data-hungry advertising companies.
|
||||
|
||||
However, the company behind the wildly successful Brave browser has developed a privacy-friendly solution, “Brave Talk.”
|
||||
|
||||
### Brave Talk: Open-Source Based Video Conferencing
|
||||
|
||||
![][1]
|
||||
|
||||
Unlike Zoom and Google Meet, Brave Talk is a piece of new video conferencing software that aims to provide better privacy than its competitors.
|
||||
|
||||
It is based on an open-source video conferencing solution i.e., [Jitsi][2], and claims to track no user data.
|
||||
|
||||
As a Brave service, alongside Brave News and Search, Brave Talk is integrated directly into the browser. While this makes it more convenient to start calls, it could be a push to promote the web browser more than ever.
|
||||
|
||||
Like Apple’s FaceTime, Brave Talk calls can only be started from a specific browser, which is Brave. This is in contrast to many other [open-source video conferencing services][3].
|
||||
|
||||
### The Push for Brave Advertising Network
|
||||
|
||||
![][4]
|
||||
|
||||
Another thing that many people may point out is that it requires the use of Brave tokens. These are kind of like frequent flyer points, except for use digitally by viewing ads.
|
||||
|
||||
For me, this wasn’t very clear, as Brave Talk never seemed to actually do anything with these tokens.
|
||||
|
||||
So, the users need to opt for Brave rewards if they want to use the service for free.
|
||||
|
||||
**Editor’s Thoughts:** Doesn’t it sound like an aggressive push to promote Brave’s advertising network?
|
||||
|
||||
Considering that it utilizes an open-source technology, it not only restricts to a particular web browser, the requirement of enabling “Brave Rewards” may seem to be a bit extreme just because it promises total privacy?
|
||||
|
||||
Of course, it is just a thought here. If the user (you) do not have any problem turning on “Brave Rewards,” Brave’s privacy-focused advertising network, and switching to Brave web browser, you may find Brave Talk an exciting option.
|
||||
|
||||
![][5]
|
||||
|
||||
### Final Thoughts
|
||||
|
||||
I believe that as a privacy-centric offering, Brave Talk sounds good on paper.
|
||||
|
||||
It may even offer a decent call quality and an engaging UI, among other things. Also, it should be mentioned that there are two tiers: a free tier and a premium option of **$7/month** with more features.
|
||||
|
||||
If you are already using Brave Rewards and have no issues with their private advertising service, it could be a good option for you. It may not be a convenient option for users who do not use the Brave web browser or do not prefer the Brave Rewards system.
|
||||
|
||||
If you want to try Brave Talk out for yourself, you will need the Brave browser. For more details, you can refer to the [official announcement][6].
|
||||
|
||||
[Brave Talk][7]
|
||||
|
||||
_What do you think about Brave Talk? 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/brave-talk/
|
||||
|
||||
作者:[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,PHN2ZyBoZWlnaHQ9IjQxOCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: https://itsfoss.com/jitsi-meet/
|
||||
[3]: https://itsfoss.com/open-source-video-conferencing-tools/
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUxOCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ3OCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[6]: https://brave.com/brave-talk-launch/
|
||||
[7]: https://talk.brave.com
|
@ -0,0 +1,88 @@
|
||||
[#]: subject: "SuperTuxKart 1.3 Release: Open Source Game for Linux Adds Switch Support"
|
||||
[#]: via: "https://news.itsfoss.com/supertuxkart-1-3-release/"
|
||||
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
SuperTuxKart 1.3 Release: Open Source Game for Linux Adds Switch Support
|
||||
======
|
||||
|
||||
One of the most popular open-source games, SuperTuxKart, has finally received a significant update after a gap of almost a year. It is a free and cross-platform 3D kart-racing game available for Linux, macOS, Windows, and Android.
|
||||
|
||||
Just like Mario Kart, you can choose from a vast catalog of characters (based on mascots of open-source projects) racing in unique karts using special items to win races in various arenas. The game also features various racing modes, including a story Mode and an online Mode, to keep you engaged.
|
||||
|
||||
Let us see what’s new with the latest release.
|
||||
|
||||
### Nintendo Switch Port
|
||||
|
||||
![Source: blog.supertuxkart.net][1]
|
||||
|
||||
SuperTuxKart is now (unofficially) playable on the Switch. This has been possible due to the SDL2 implementation that was already used in the previous 1.2 release. To play the game, you will need to have **Homebrew** installed on your console.
|
||||
|
||||
Moreover, the game also supports force feedback for the Joy-Cons and other controllers. This will undoubtedly make the game more lively whenever there are effects on-screen.
|
||||
|
||||
### New Arenas
|
||||
|
||||
Two new arenas — Ancient Colosseum Labyrinth and Alien Signal — have been introduced.
|
||||
|
||||
![Source: blog.supertuxkart.net][2]
|
||||
|
||||
The Ancient Colosseum Labyrinth is based on the Roman Colosseum with a dark setting and a secret tunnel. On the other hand, the Alien Signal is another arena inspired by a SETI-styled location with strange markings on the ground.
|
||||
|
||||
The Las Dunas Soccer Stadium has also been updated and now houses a symmetrical soccer field.
|
||||
|
||||
Lastly, lap line extensions have been added to various tracks. This means the lap will be counted even if you drive slightly off the main road.
|
||||
|
||||
### GUI Improvements
|
||||
|
||||
A major feature that will improve the gameplay experience is the introduction of **render resolution**. Using the slider, you can sacrifice the resolution for better frame rates on low-end systems.
|
||||
|
||||
The high score selection screen now has its independent menu and displays the best times for normal races, egg hunts, and time trials.
|
||||
|
||||
You can also open links in the game. Specifically, the links in a text/instruction that pops up in the game. This is possible, thanks to the SDL2 SDL_OpenURL.
|
||||
|
||||
Blender 2.8 was officially used by artists to create tracks, maps, and more.
|
||||
|
||||
### Redesigned Karts
|
||||
|
||||
![Source: blog.supertuxkart.net][3]
|
||||
|
||||
Your favorite characters like GNU, Adiumy and Emule have undergone visual changes. Sara the Racer is now replaced by Pepper, the mascot of Pepper&Carrot.
|
||||
|
||||
You can refer to the [official release notes][4] for detailed information about the update.
|
||||
|
||||
[Download SuperTuxKart 1.3][5]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Overall, SuperTuxKart 1.3 has brought in exciting changes and fixes. Nintendo Switch users will now have something fresh to try out and play!
|
||||
|
||||
What do you think about this release? Will you be willing to try it out on your Switch? Do share your thoughts 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/supertuxkart-1-3-release/
|
||||
|
||||
作者:[Rishabh Moharir][a]
|
||||
选题:[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/rishabh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjczMiIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM2NSIgd2lkdGg9IjY0OSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI2NCIgd2lkdGg9IjI0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[4]: https://blog.supertuxkart.net/2021/09/supertuxkart-13-release.html
|
||||
[5]: https://github.com/supertuxkart/stk-code/releases/tag/1.3
|
@ -0,0 +1,59 @@
|
||||
[#]: subject: "Open Source Changed Linux Otherwise It Was Done: Linus Torvalds"
|
||||
[#]: via: "https://news.itsfoss.com/open-source-changed-linux-torvalds/"
|
||||
[#]: author: "Abhishek https://news.itsfoss.com/author/root/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Open Source Changed Linux Otherwise It Was Done: Linus Torvalds
|
||||
======
|
||||
|
||||
You probably already know the story. 30 years ago, Finnish student Linus Torvalds created a UNIX-like operating system as a hobby project.
|
||||
|
||||
What you do not know is that Torvalds thought that the hobby project was done, and he would have left it behind to work on some new and interesting project.
|
||||
|
||||
So, what made his work on this ‘hobby project’ for 30 years? The answer is open source.
|
||||
|
||||
### Open source changed Linux
|
||||
|
||||
At the recently concluded [Open Source Summit North America event][1], Linus Torvalds shared some insights into the past, present and future of the Linux project.
|
||||
|
||||
While remembering the beginning of the project, [Torvalds said][2] that he’d expected to leave behind Linux in a ‘done state’ to work for something new and interesting.
|
||||
|
||||
> That was clearly then what open source changed. Because suddenly this project — that I probably would’ve left behind, if it was only up to me — I started getting questions about, and eventually patches — that just kept the motivation going. And here we are 30 years later, and it’s still what keeps the motivation going.
|
||||
|
||||
Torvalds also added that as far as he is concerned, Linux is done for the past 29 years. Every other feature that has been added later is about what other people needed, wanted or were interested in.
|
||||
|
||||
Many developers would relate to this. You work on a project and think that it has reached a ‘done’ state. If the project does not get enough traction, you lose interest to work on it and move to something ‘new and exciting’. The real motivation to continue the project comes from the users and the recognition.
|
||||
|
||||
When asked about what they should be doing for the 50th anniversary of Linux, Torvalds said that he doesn’t see himself doing kernel programming at the age of 70. Then he also chipped in that he didn’t imagine himself doing kernel programming at the age of 50 as well and yet he is doing that at present.
|
||||
|
||||
> “Somehow I don’t see myself doing kernel programming when I’m 70. But on the other hand, I didn’t see myself doing kernel programming when I was 50 either, a few years back. So… we’ll see.”
|
||||
|
||||
It is always endearing to listen to Torvalds talking about Linux. So much to learn and to relate as an ardent Linux user, right?
|
||||
|
||||
_Source: [The News Stack][2]_
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/open-source-changed-linux-torvalds/
|
||||
|
||||
作者:[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://events.linuxfoundation.org/open-source-summit-north-america/
|
||||
[2]: https://thenewstack.io/linus-torvalds-on-community-rust-and-linuxs-longevity/
|
@ -0,0 +1,79 @@
|
||||
[#]: subject: "It Seems Pop OS Linux Will Soon be Available on Raspberry Pi and Other ARM Devices"
|
||||
[#]: via: "https://news.itsfoss.com/pop-os-raspberry-pi-coming-soon/"
|
||||
[#]: author: "Abhishek https://news.itsfoss.com/author/root/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
It Seems Pop OS Linux Will Soon be Available on Raspberry Pi and Other ARM Devices
|
||||
======
|
||||
|
||||
There was a time when only lightweight [operating systems were available for ARM devices like Ra][1]spberry Pi. Why? Because earlier ARM devices had low end hardware with limited RAM and CPU.
|
||||
|
||||
It all changed when Raspberry Pi 4 targeted desktop users with its 8 GB variant and doubled down on it with the introduction of Raspberry Pi 400.
|
||||
|
||||
This resulted in bringing the support of mainstream desktop Linux distributions to Raspberry Pi. Thanks to that, you can now [install Ubuntu desktop on Raspberry Pi][2].
|
||||
|
||||
Since Ubuntu desktop now supports ARM devices, other Ubuntu-based distros should join the ARM bandwagon soon. And it seems Pop!_OS is ready to board it.
|
||||
|
||||
### Pop OS coming soon on Raspberry Pi!
|
||||
|
||||
System76’s Principal Engineer and maintainer of Pop!_OS, Jeremy Soller shared a teaser photo on Twitter recently. The image is basically a screenshot of Neofetch running in terminal.
|
||||
|
||||
> <https://t.co/OXg3Md0erk> [pic.twitter.com/ehfGXwtsBf][3]
|
||||
>
|
||||
> — Jeremy Soller (@jeremy_soller) [September 28, 2021][4]
|
||||
|
||||
If you look closely, you can see that some details that indicate that it is running on a Raspberry Pi device.
|
||||
|
||||
![][5]
|
||||
|
||||
The host name indicates Raspberry Pi and so does the BCM2835 CPU (chip used on Raspberry Pi devices). You can also notice the aarch64 in the OS name.
|
||||
|
||||
In addition to that, Jeremy also shared a repository link that contains Pop OS packages for ARM devices. Here’s the [link][6].
|
||||
|
||||
> 😉 <https://t.co/pKIbxX2iFk>
|
||||
>
|
||||
> — Jeremy Soller (@jeremy_soller) [September 28, 2021][7]
|
||||
|
||||
### How soon?
|
||||
|
||||
There is no other information available from Systm76 on this front. But if I have to make a guess, I would say that the upcoming Pop!_OS 21.10 version will have an ARM version for Raspberry Pi like devices.
|
||||
|
||||
This is not a blind guess. The ARM repository link shared by Jeremy clearly mentions ‘impish’ in its directory structure. Impish Indri is the codename for the upcoming [Ubuntu 21.10 slated for release][8] on 14th October.
|
||||
|
||||
Pop!_OS 21.10 follows the release of Ubuntu 21.10 and should be released soon afterwards. All this gives us enough clue to surmise that Pop!_OS is coming to Raspberry Pi devices this month.
|
||||
|
||||
This is indeed a good thing because Pop!_OS is popular among developers. This could mean more developers using Raspberry Pi as their development environment.
|
||||
|
||||
I am delighted to see this development. How about you?
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/pop-os-raspberry-pi-coming-soon/
|
||||
|
||||
作者:[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/raspberry-pi-os/
|
||||
[2]: https://itsfoss.com/install-ubuntu-desktop-raspberry-pi/
|
||||
[3]: https://t.co/ehfGXwtsBf
|
||||
[4]: https://twitter.com/jeremy_soller/status/1442977756623429640?ref_src=twsrc%5Etfw
|
||||
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ2OCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[6]: https://apt.pop-os.org/release/dists/impish/main/binary-arm64/
|
||||
[7]: https://twitter.com/jeremy_soller/status/1442976088053796870?ref_src=twsrc%5Etfw
|
||||
[8]: https://news.itsfoss.com/ubuntu-21-10-release-schedule/
|
@ -0,0 +1,79 @@
|
||||
[#]: subject: "GNOME 42 to Introduce a System-wide Dark Style Preference, Thanks to elementary OS"
|
||||
[#]: via: "https://news.itsfoss.com/gnome-42-dark-style-preference/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
GNOME 42 to Introduce a System-wide Dark Style Preference, Thanks to elementary OS
|
||||
======
|
||||
|
||||
There’s still time for GNOME 42, but it looks like it will implement a system-wide dark mode preference similar to [elementary OS 6][1].
|
||||
|
||||
If you have been reading our coverages, you must have noticed mentioning it as one of the [best elementary OS 6 features][2].
|
||||
|
||||
And for all the right reasons. Unlike a GTK theme change, elementary OS 6 approached the dark style preference as an opt-in preference that application developers can detect and choose to respect.
|
||||
|
||||
Even though this means that there’s more to be expected from the app developers, but when successful, it should result in a consistent dark mode experience.
|
||||
|
||||
In a [blog post][3] by GNOME developer _Alex_, he mentioned that GNOME would be following elementary OS’s approach while making it a standard to introduce a system-wide dark style preference in GNOME 42.
|
||||
|
||||
### Consistent Dark Mode Experience Even with Flatpak Sandbox
|
||||
|
||||
When it comes to a GTK theme, it is often a problem for Flatpak applications to inherit it because of the sandboxing.
|
||||
|
||||
However, with an implementation planned for GNOME 42, any application (including Flatpak apps) can access the settings portal and know the dark style preference without cutting down the security provided by the sandboxing.
|
||||
|
||||
This work aims to ensure that every type of application (built with any toolkit) and on any desktop should be able to detect and respect the dark style preference.
|
||||
|
||||
The only difference between elementary OS and GNOME’s implementation will be the use of libadwaita API with GNOME 42. You may want to check out an older [blog post][4] by Adrien, another GNOME developer, to know more about Libadwaita.
|
||||
|
||||
Alex also shared a video giving a sneak peek at how the transitions may look like (which is, of course, a work in progress).
|
||||
|
||||
![][5]
|
||||
|
||||
As you can notice, application developers need to update their applications to respect this preference to make the switch/transition from light/dark mode a seamless experience.
|
||||
|
||||
And, further, to bring this change to GNOME 42, there is a couple of significant development work remaining:
|
||||
|
||||
* A preference option in the settings menu that’s easy to use (probably under “Background/Appearance” settings)
|
||||
* A switch in gnome-shell to quickly toggle the preference
|
||||
* Day/night scheduling option
|
||||
* A dark mode version of the wallpaper synchronized to the preference
|
||||
|
||||
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
The core and first-party applications will have to support the dark style preference before GNOME 42 release to kick things off.
|
||||
|
||||
While third-party developers should also get on the bandwagon, given the difference this makes, it would take time for all your essential/favorite tools to support it.
|
||||
|
||||
_What do you think about GNOME 42 bringing a system-wide dark mode preference, following the footsteps of elementary OS? You are welcome to share your thoughts in the comments down 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/gnome-42-dark-style-preference/
|
||||
|
||||
作者:[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/elementary-os-6-release/
|
||||
[2]: https://news.itsfoss.com/elementary-os-6-features/
|
||||
[3]: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/
|
||||
[4]: https://aplazas.pages.gitlab.gnome.org/blog/blog/2021/03/31/introducing-libadwaita.html
|
||||
[5]: https://i0.wp.com/i.ytimg.com/vi/urXch15ySGU/hqdefault.jpg?w=780&ssl=1
|
@ -0,0 +1,93 @@
|
||||
[#]: subject: "Feren OS 2021.10 Release Introduces a New Firefox Configuration and UI Improvements"
|
||||
[#]: via: "https://news.itsfoss.com/feren-os-2021-10-release/"
|
||||
[#]: author: "Omar Maarof https://news.itsfoss.com/author/omar/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Feren OS 2021.10 Release Introduces a New Firefox Configuration and UI Improvements
|
||||
======
|
||||
|
||||
Feren OS is a Linux/GNU distribution based on Ubuntu.
|
||||
|
||||
The latest 2021.10 release, codenamed ‘Gallium’, presents new features and changes. Let’s take a look at them.
|
||||
|
||||
### Feren OS 2021.10: What’s New?
|
||||
|
||||
#### A New Configuration For Mozilla Firefox
|
||||
|
||||
![][1]
|
||||
|
||||
Feren OS 2021.10 aims to offer a hassle-free Mozilla web browsing experience by removing the unnecessary elements of the browser.
|
||||
|
||||
For new users, Mozilla Firefox comes pre-installed with a new configuration. Things like [removing the title bar from Mozilla Firefox][2], getting rid of distractions in a new tab, are some of the configurations made.
|
||||
|
||||
Overall, these are the changes made to Firefox:
|
||||
|
||||
* Compact Mode and no title bar by default
|
||||
* No Pocket by default
|
||||
* The Library is now in the toolbar (as was intended by Mozilla themselves during early Proton design ideas) instead of Pocket’s button
|
||||
* Skipped Welcome Screens to allow you to get right into the action
|
||||
|
||||
|
||||
|
||||
If you have never launched Firefox (or have a fresh install of Feren OS), you will get the configuration out-of-the-box. In either case, you will have to install the **firefox-config-feren** package from the web browser manager.
|
||||
|
||||
#### New Splash Screen
|
||||
|
||||
The new update comes with a redesigned splash screen. As a consequence, now it looks smoother and more elegant, especially when transitioning from the login screen to the desktop.
|
||||
|
||||
![][3]
|
||||
|
||||
#### Refreshed Lock Screen
|
||||
|
||||
The new lock screen is a mixture of the Feren OS login screen’s design style and KDE plasma’s lock screen features.
|
||||
|
||||
![Feren OS 2021.10 Lock Screen][4]
|
||||
|
||||
As a result, it combines elegance and functionality. From the lock screen, you will have access to your music, a virtual keyboard, and more.
|
||||
|
||||
![Feren OS 2021.10 Login Screen][4]
|
||||
|
||||
#### New Wallpapers
|
||||
|
||||
With every new release, you can notice some new wallpapers. And, Feren OS 2021.10 is no exception.
|
||||
|
||||
Some interesting wallpapers have been added from sources like Unsplash and some were removed.
|
||||
|
||||
### Upgrading & Downloading
|
||||
|
||||
You should be easily able to get the new update from the update manager. In case you run into issues, you can refer to the [official blog post][5] for a solution to fix the most common problem encountered when updating.
|
||||
|
||||
For more details on this release, refer to [the official announcement][6].
|
||||
|
||||
[Download Feren OS 2021.10][7]
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/feren-os-2021-10-release/
|
||||
|
||||
作者:[Omar Maarof][a]
|
||||
选题:[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/omar/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQzOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: https://itsfoss.com/remove-title-bar-firefox/
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM5MyIgd2lkdGg9IjcwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM1OCIgd2lkdGg9IjcwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[5]: https://medium.com/feren-os/the-repository-keyring-expired-heres-how-to-renew-it-bd50dd874aac
|
||||
[6]: https://medium.com/feren-os/feren-os-2021-10-iterative-improvements-993aab5dba51
|
||||
[7]: https://ferenos.weebly.com/get-feren-os.html
|
@ -0,0 +1,85 @@
|
||||
[#]: subject: "TUXEDO’s Linux Gaming Ultrabook “InfinityBook Pro 14” Now Sports an RTX 3050 Ti and 3K Display"
|
||||
[#]: via: "https://news.itsfoss.com/tuxedos-infinitybook-14/"
|
||||
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
TUXEDO’s Linux Gaming Ultrabook “InfinityBook Pro 14” Now Sports an RTX 3050 Ti and 3K Display
|
||||
======
|
||||
|
||||
Tuxedo has recently unveiled its latest and exciting revision to its InfinityBook Pro 14. Despite weighing just around one kg, this sleek-looking ultrabook packs in impressive specs and can pretty much run various AAA games. Let’s take a look at what this laptop has to offer.
|
||||
|
||||
### Updated Specifications
|
||||
|
||||
![Source: Tuxedo][1]
|
||||
|
||||
#### Processor Upgrade
|
||||
|
||||
The refreshed offering has updated the processors to high-performance **Intel Core i5-11300H and Core i7-11370H** instead of the power-saving chips in the previous iteration.
|
||||
|
||||
In case you didn’t know, the performance-oriented chips can utilize up to 60 watts (TDP) to provide you the enhanced performance.
|
||||
|
||||
#### New-Gen RTX Graphics
|
||||
|
||||
As for the graphics side, you’ll find NVIDIA’s mid-range **GeForce RTX 3050 Ti** along with the integrated Iris Xe graphics. This is a power-efficient MaxQ variant that promises a TGP of 35 watts.
|
||||
|
||||
Considering this as a mid-tier GPU, it should be enough for gaming with 1080p settings.
|
||||
|
||||
Do note there are no 3050ti available in the market separately. It is currently limited to OEMs/laptops.
|
||||
|
||||
This graphics card is very beneficial for gamers on the go as it supports NVIDIA’s DLSS, like all RTX GPUs, for a stepped-up gaming experience.
|
||||
|
||||
Also, it’s never been a better time because Linux gamers can now [enable DLSS for DX11/12 and Vulkan-based games like Cyberpunk 2077][2].
|
||||
|
||||
### Other Features
|
||||
|
||||
If you’re worried about cooling, fret not. The laptop comes with an all-new cooling system that contains two heat pipes and two fans. Thus, working under heavy workloads is no longer an issue.
|
||||
|
||||
As for the storage and memory, two M.2 NVME SSD slots and dual-channel RAM up to 64 GB can be seen.
|
||||
|
||||
The I/O ports include an HDMI 2.0, USB-C 3.2 Gen2, two USB-A 3.2 Gen1 ports, an SD card reader, and a Thunderbolt 4 port.
|
||||
|
||||
Finally, a large **53 Wh battery** is also included that ensures 12 hours (idle) of runtime. This is pretty helpful to that stunning 14 inch **Omnia 3K IPS display.**
|
||||
|
||||
### Availability and Pricing
|
||||
|
||||
The InfinityBook Pro 14 **starts at 1180 EUR** and goes all the way **up to 1770 EUR** if you need the 3K Omnia display and Core i7-11370H.
|
||||
|
||||
Preorders have already started from Oct 6th. You can head to its official website to explore more about the product and its availability.
|
||||
|
||||
[TUXEDO Computers][3]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
This is one beast of an ultrabook that doubles as a gaming laptop. However, I don’t understand the inclusion of 3050ti with a 3K display. So, if you are looking for other options, I would suggest [exploring other places to buy Linux laptops][4].
|
||||
|
||||
Users frequently on the go will find this laptop useful for both work and play, thanks to the laptop’s weight and power.
|
||||
|
||||
_What do you think about this laptop? Do share your thoughts 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/tuxedos-infinitybook-14/
|
||||
|
||||
作者:[Rishabh Moharir][a]
|
||||
选题:[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/rishabh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjU2NyIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: https://news.itsfoss.com/nvidia-dlss-dx-11-12-proton/
|
||||
[3]: https://www.tuxedocomputers.com/en/Linux-Hardware/Linux-Notebooks/10-14-inch/TUXEDO-InfinityBook-Pro-14-Gen6.tuxedo#
|
||||
[4]: https://itsfoss.com/get-linux-laptops/
|
@ -1,67 +0,0 @@
|
||||
[#]: subject: "When Linus Torvalds Was Wrong About Linux (And I am Happy He Was Wrong)"
|
||||
[#]: via: "https://news.itsfoss.com/trovalds-linux-announcement/"
|
||||
[#]: author: "Abhishek https://news.itsfoss.com/author/root/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
When Linus Torvalds Was Wrong About Linux (And I am Happy He Was Wrong)
|
||||
======
|
||||
|
||||
Linus Torvalds, the creator of Linux kernel and Git, needs no introduction.
|
||||
|
||||
A shy geek who does not talk much in public but prefers mailing lists. Loves codes and gadgets more than other things. Prefers working from home than spending time in shiny offices.
|
||||
|
||||
Torvalds expresses his opinion on Linux related things quite vocally. We can’t forget the ‘finger to Nvidia’ moment that forced Nvidia to improve Linux support (it was way worse back in 2012).
|
||||
|
||||
Generally, I agree with his opinion and most often his views have turned out to be correct. Except in this one case (and that’s a good thing).
|
||||
|
||||
### Torvalds’ “incorrect prediction” on Linux
|
||||
|
||||
30 years ago, Torvalds announced the Linux project. He was a university student at that time and wanted to create a UNIX-like operating system because UNIX itself was too costly.
|
||||
|
||||
While announcing the project, Torvalds mentioned that the project was just a hobby and it won’t be big and professional like GNU.
|
||||
|
||||
> I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 386(486) AT clones.
|
||||
|
||||
Linus Torvalds while announcing the Linux project
|
||||
|
||||
Little did Torvalds knew that his ‘hobby’ will become the backbone of today’s IT world and the face of a successful open source project.
|
||||
|
||||
Here’s the complete message he sent:
|
||||
|
||||
Hello everybody out there using minix –
|
||||
|
||||
I’ve currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I’ll get something practical within a few months, and I’d like to know what features most people would want. Any suggestions are welcome, but I won’t promise I’ll implement them 🙂
|
||||
|
||||
Linus ([torv…@kruuna.helsinki.fi][1])
|
||||
|
||||
PS. Yes – it’s free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that’s all I have :-(.
|
||||
|
||||
That was on 25th August 1991. Torvalds announced the Linux project and then on 5th October 1991, he released the first Linux kernel. The [interesting fact about Linux][2] is that it was not open source initially. It was released under GPL license a year later.
|
||||
|
||||
The Linux Kernel is 30 years old today. Happy 30th to this amazing open source project.
|
||||
|
||||
#### 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/trovalds-linux-announcement/
|
||||
|
||||
作者:[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://groups.google.com/
|
||||
[2]: https://itsfoss.com/facts-linux-kernel/
|
101
sources/talk/20210928 Modeling open management practices.md
Normal file
101
sources/talk/20210928 Modeling open management practices.md
Normal file
@ -0,0 +1,101 @@
|
||||
[#]: subject: "Modeling open management practices"
|
||||
[#]: via: "https://opensource.com/open-organization/21/9/modeling-open-management"
|
||||
[#]: author: "Heidi Hess von Ludewig https://opensource.com/users/heidi-hess-von-ludewig"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Modeling open management practices
|
||||
======
|
||||
How can managers know if other leaders are cultivating an open culture?
|
||||
Ask the people they impact every day.
|
||||
![Women talking][1]
|
||||
|
||||
In the [first part of my interview with Sam Knuth][2], a fellow [Open Organization Ambassador][3], we discussed how leaders need to make time to be open. Openness isn't effortless.
|
||||
|
||||
In this second part, Sam and I discuss how executive leaders support their managers and teams in [leading with open values][4]. Because of the confidentiality of some of the answers (we're colleagues at Red Hat, after all), I am summarizing the interview in a series of articles that highlight and share some of Sam's most memorable observations and practices.
|
||||
|
||||
### Managing managers
|
||||
|
||||
Executive and senior leaders manage groups of managers, which means they may have little (or no) direct, routine contact with individual contributors in their organizations. So if they're interested in promoting open cultures throughout their organizations, they'll need to continuously model the open management practices they expect to see from all the managers in their team.
|
||||
|
||||
Executive and senior leaders, however, don't only _promote_ open culture; they're also members of the organizational communities they want to see thrive, and like other members they shoulder some accountability for the health and vitality of that culture. Like all other members of an open organization community, managers are accountable for being _stewards_ (even protectors) of the values of the community as well. Senior leaders are responsible—as is any community member—for challenging behaviors that are unsupportive of open values.
|
||||
|
||||
But this work is even more critical in the case of managers, especially because managers can enjoy enhanced decision-making power in many open organizations, and they influence more and more people the higher their role in an organization's hierarchy they sit.
|
||||
|
||||
So how can executive leaders promote and protect open values in their organizations? Sam described a multi-factor approach to gathering and understanding associates' perspectives of their managers' leadership competencies.
|
||||
|
||||
#### Meeting one-on-one
|
||||
|
||||
As Sam's organization grew and more layers of management formed, Sam found he didn't have ongoing conversations with associates who weren't directly reporting to him, and was losing touch with how employees were feeling. Those _feelings_ are integral to any understanding of the organizational culture individual contributors experience every day.
|
||||
|
||||
The bottom line? However you connect with associates, cultivating psychological safety is important for generating candid discussions.
|
||||
|
||||
So Sam set up [one-on-one meetings][5] to connect with associates throughout the organization, choosing as randomly as he could. This helped create a safe space and develop trust in a confidential environment. Sam did this across his 250-associate organization by scheduling two to three meetings every week, because he felt it was the best way to get a sense of everyone's perspectives. It also gave him opportunities to share what he was learning with the managers in his organization and to coach them on becoming open leaders and champions of open values among their peers.
|
||||
|
||||
During these discussions, he listened actively and asked many questions. Red Hatters can be quite forthcoming in their feedback, but asking questions helped Sam pick up on subtle cues when necessary. This way, he could ferret out an accurate sense of the situation, asking himself, "Does what the associates' say line up with what I think the leaders are intending? Where does it seem like alignment is not occurring? Why?"
|
||||
|
||||
It's an individualized approach that's both time-consuming and candid, and Sam found it to be well worth the effort.
|
||||
|
||||
It's also the opposite of a process I recalled from my past life in a conventional organization. As Sam and I chatted, I remembered "round tables," where an executive would set up team discussions to (allegedly) understand associates' perspectives. It was supposed to be a venue for collecting feedback and constructive criticism—but, in practice, no one said anything to the visiting executive that they hadn’t shared with team or department leaders, so there was no candid discussion _about_ those team or department leaders. I didn't feel any [sense of psychological safety][6], which is required in order for associates to share their thoughts. In my case, the round tables were completely ineffective.
|
||||
|
||||
The bottom line? However you connect with associates—individually or in groups—cultivating psychological safety is important for generating candid discussions.
|
||||
|
||||
Travelling to meet associates was ideal for these kinds of individual meetings to occur face-to-face, but the pandemic changed this tactic. On the other hand, workplaces across the world were already becoming more distributed before the pandemic; in fact, Sam struggled to meet associates in the United States because of the distribution of sites and even associates working remotely! To overcome this, leaders can set up one-on-one teleconferences with associates. In cases where associates seem to be less forthcoming or fearful of sharing their opinions, leaders can ask probing (but not direct) questions of the associates to get feedback as best as they can. For instance, leaders can glean a great deal of information from how associates answer questions such as:
|
||||
|
||||
* How are you feeling about your work?
|
||||
* What kinds of challenges do you encounter in your work?
|
||||
* Do you feel like you get the support you need to do your work?
|
||||
* How well do you feel you connect with your manager? Colleagues?
|
||||
|
||||
|
||||
|
||||
#### On (not) using surveys
|
||||
|
||||
Finally, Sam and I discussed surveys. After all, couldn't someone achieve the same results using a survey—without all that extra legwork?
|
||||
|
||||
Surveys have their place in tracking the health of an open culture, Sam told me, but on their own they're rarely sufficient for doing this. For starters, Sam said, using surveys requires skill in both asking quantifiable questions and analyzing data, and that kind of skill isn't as common as we tend to think it is. Without proper expertise in using survey instruments, we may be letting data mislead us (for instance, when we gloss over problems because we see a high average score on another, similar question). So Sam finds surveys most useful for capturing a _broad perspective_ on team- or department-level experience of a culture and a manager's role in creating and maintaining it.
|
||||
|
||||
Getting an accurate sense of specific details or issues is difficult when using surveys, which tend to ask for more generic feedback. Painting a more complete picture really requires sitting down with people and talking to them.
|
||||
|
||||
Getting an accurate sense of specific details or issues is difficult when using surveys, which tend to ask for more generic feedback. Painting a more complete picture really requires sitting down with people and talking to them, Sam insisted.
|
||||
|
||||
That's why it's important to investigate and spend time learning about the work culture in your organization from the associates themselves. Use a combination of techniques, and open multiple channels to facilitate feedback in as many forms as possible, as different people feel comfortable with different media.
|
||||
|
||||
### When managers aren't open
|
||||
|
||||
Like any role, managers learn skills and behaviors that help them succeed in particular organizations. When they get hired into an open organization (like Red Hat), they might experience some "abrasion" (my term), because there can be a genuine belief that a manager is managing with open values even though that person's _vision_ of open values doesn't match that of the organization.
|
||||
|
||||
I recalled personal experience with this, where I had a manager who probably _thought_ they were being open, but really wasn't.
|
||||
|
||||
"Exactly," Sam said, "and it's very painful."
|
||||
|
||||
_Listen to Sam Knuth describe difficulties helping managers become more open._
|
||||
|
||||
When managers really aren't sufficiently "open," it's an issue that has to be addressed—because it can be damaging to teams. Sometimes managers can unlearn their conventional skills and behaviors. And sometimes they can't. Sometimes the change has to happen quickly so that the team doesn’t suffer. Ultimately, the organization's executive leader must embody that organization's culture.
|
||||
|
||||
So "open management" then becomes a question of "open by whose standards?" and the organization must make those standards explicit in some way. That means deliberately codifying what the organization _means_ by "openness." Some organizations might draw up a simple social contract to accomplish this—a description of open principles and practices that all agree to let guide them. Other organizations might go so far as to formalize certain managerial competencies that align with the open culture an organization seeks to maintain. Regardless of the approach, however, it's important that an open organization fosters transparent discussions about behaviors it _does_ and _doesn't_ want to see its managers reflecting and encouraging. In this way, executive leaders can be those stewards for an organization's open culture.
|
||||
|
||||
In the final part of my interview with Sam, I'll describe another important open management tactic I learned during our conversation: daring to be vulnerable.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/21/9/modeling-open-management
|
||||
|
||||
作者:[Heidi Hess von Ludewig][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/heidi-hess-von-ludewig
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/conversation-interview-mentor.png?itok=HjoOPcrB (Women talking)
|
||||
[2]: https://opensource.com/open-organization/21/3/open-practices-executive-leaders
|
||||
[3]: https://github.com/open-organization/governance/blob/master/community-roster.md
|
||||
[4]: https://opensource.com/open-organization/managing-with-open-values
|
||||
[5]: https://opensource.com/open-organization/21/8/one-on-one-meeting-tips
|
||||
[6]: https://opensource.com/open-organization/19/3/introduction-psychological-safety
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (unigeorge)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
@ -69,7 +69,7 @@ via: https://opensource.com/article/20/2/real-time-data-processing
|
||||
|
||||
作者:[Simon Crosby][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[unigeorge](https://github.com/unigeorge)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (anine09)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
@ -108,7 +108,7 @@ via: https://opensource.com/article/20/3/sonic-pi
|
||||
|
||||
作者:[Matt Bargenquast][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[译者ID](https://github.com/anine09)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (Pinkerr)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,134 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Learn Fortran by writing a "guess the number" game)
|
||||
[#]: via: (https://opensource.com/article/21/1/fortran)
|
||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||
|
||||
Learn Fortran by writing a "guess the number" game
|
||||
======
|
||||
Because Fortran was written in the punched card era, its syntax is
|
||||
pretty limited. But you can still write useful and interesting programs
|
||||
with it.
|
||||
![Person typing on a 1980's computer][1]
|
||||
|
||||
The first compiled programming language I learned was Fortran 77. While growing up, I taught myself how to write programs in BASIC on the Apple II and later in QBasic on DOS. But when I went to university to study physics, I learned [Fortran][2].
|
||||
|
||||
Fortran used to be quite common in scientific computing. And once upon a time, all computer systems had a Fortran compiler. Fortran used to be as ubiquitous as Python is today. So if you were a physics student like me, working in the 1990s, you learned Fortran.
|
||||
|
||||
I always thought Fortran was somewhat similar to BASIC, so I quickly took to Fortran whenever I needed to write a quick program to analyze lab data or perform some other numerical analysis. And when I got bored, I wrote a "Guess the number" game in Fortran, where the computer picks a number between one and 100 and asks me to guess the number. The program loops until I guess correctly.
|
||||
|
||||
The "Guess the number" program exercises several concepts in programming languages: how to assign values to variables, how to write statements, and how to perform conditional evaluation and loops. It's a great practical experiment for learning a new programming language.
|
||||
|
||||
### The basics of Fortran programming
|
||||
|
||||
While Fortran has been updated over the years, I am most familiar with Fortran 77, the implementation I learned years ago. Fortran was created when programmers wrote programs on punched cards, so "classic" Fortran is limited to the data you could put on a punched card. That means you could only write classic Fortran programs with these limitations:
|
||||
|
||||
* Only one line of source code per card is allowed.
|
||||
* Only columns 1–72 are recognized (the last eight columns, 73-80, are reserved for the card sorter).
|
||||
* Line numbers ("labels") are in columns 1–5.
|
||||
* Program statements go in columns 7–72.
|
||||
* To continue a program line, enter a continuation character (usually `+`) in column 6.
|
||||
* To create a comment line, enter `C` or `*` in column 1.
|
||||
* Only the characters `A` to `Z` (uppercase), `0` to `9` (numbers), and the special characters `= + - * / ( ) , . $ ' :` and space are used.
|
||||
|
||||
|
||||
|
||||
With these limitations, you can still write very useful and interesting programs.
|
||||
|
||||
### Guess the number in Fortran
|
||||
|
||||
Explore Fortran by writing the "Guess the number" game. This is my implementation:
|
||||
|
||||
|
||||
```
|
||||
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
||||
C PROGRAM TO GUESS A NUMBER 1-100
|
||||
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
||||
PROGRAM GUESSNUM
|
||||
INTEGER SEED, NUMBER, GUESS
|
||||
|
||||
PRINT *, 'ENTER A RANDOM NUMBER SEED'
|
||||
READ *, SEED
|
||||
CALL SRAND(SEED)
|
||||
|
||||
NUMBER = INT( RAND(0) * 100 + 1 )
|
||||
|
||||
PRINT *, 'GUESS A NUMBER BETWEEN 1 AND 100'
|
||||
10 READ *, GUESS
|
||||
|
||||
IF (GUESS.LT.NUMBER) THEN
|
||||
PRINT *, 'TOO LOW'
|
||||
ELSE IF (GUESS.GT.NUMBER) THEN
|
||||
PRINT *, 'TOO HIGH'
|
||||
ENDIF
|
||||
|
||||
IF (GUESS.NE.NUMBER) GOTO 10
|
||||
|
||||
PRINT *, 'THATS RIGHT!'
|
||||
END
|
||||
```
|
||||
|
||||
If you are familiar with other programming languages, you can probably figure out what this program is doing by reading the source code. The first three lines are a comment block to indicate the program's function. The fourth line, `PROGRAM GUESSNUM`, identifies this as a program, and it is closed by the `END` statement on the last line.
|
||||
|
||||
After defining a few variables, the program prompts the user to enter a random number seed. A Fortran program cannot initialize the random number generator from the operating system, so you must always start the random number generator with a "seed" value and the `SRAND` subroutine.
|
||||
|
||||
Fortran generates random numbers between 0 and 0.999... with the `RAND(0)` function. The `0` value tells the `RAND` function to generate another random number. Multiply this random number by 100 to generate a number between 0 and 99.999…, and then add 1 to get a value between 1 and 100.999… The `INT` function truncates this to an integer; thus, the variable `NUMBER` is a random number between 1 and 100.
|
||||
|
||||
The program prompts the user, then enters a loop. Fortran doesn't support the `while` or `do-while` loops available in more modern programming languages. Instead, you must construct your own using labels (line numbers) and `GOTO` statements. That's why the `READ` statement has a line number; you can jump to this label with the `GOTO` at the end of the loop.
|
||||
|
||||
Punched cards did not have the `<` (less than) or `>` (greater than) symbols, so Fortran adopted a different syntax to compare values. To test if one value is less than another, use the `.LT.` (less than) comparison. To test if a value is greater than another, use `.GT.` (greater than). Equal and not equal are `.EQ.` and `.NE.`, respectively.
|
||||
|
||||
In each iteration of the loop, the program tests the user's guess. If the user's guess is less than the random number, the program prints `TOO LOW`, and if the guess is greater than the random number, the program prints `TOO HIGH`. The loop continues until the user's guess is the same as the random number.
|
||||
|
||||
When the loop exits, the program prints `THATS RIGHT!` and ends immediately.
|
||||
|
||||
|
||||
```
|
||||
$ gfortran -Wall -o guess guess.f
|
||||
|
||||
$ ./guess
|
||||
ENTER A RANDOM NUMBER SEED
|
||||
93759
|
||||
GUESS A NUMBER BETWEEN 1 AND 100
|
||||
50
|
||||
TOO LOW
|
||||
80
|
||||
TOO HIGH
|
||||
60
|
||||
TOO LOW
|
||||
70
|
||||
TOO LOW
|
||||
75
|
||||
TOO HIGH
|
||||
73
|
||||
TOO LOW
|
||||
74
|
||||
THATS RIGHT!
|
||||
```
|
||||
|
||||
Every time you run the program, the user needs to enter a different random number seed. If you always enter the same seed, the program will always pick the same random number.
|
||||
|
||||
### Try it in other languages
|
||||
|
||||
This "guess the number" game is a great introductory program when 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 and compare each language's 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/21/1/fortran
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
|
||||
[2]: https://en.wikipedia.org/wiki/Fortran
|
@ -1,184 +0,0 @@
|
||||
[#]: subject: (Comparing Linux Mint and Fedora: Which One Should You Use?)
|
||||
[#]: via: (https://itsfoss.com/linux-mint-vs-fedora/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Comparing Linux Mint and Fedora: Which One Should You Use?
|
||||
======
|
||||
|
||||
Linux Mint is a [popular Linux distribution tailored for beginners][1] while providing a similar experience to former Windows users. In fact, it does a [few things better than Ubuntu][2], which makes it a suitable choice for every type of user.
|
||||
|
||||
It is completely community-powered, on top of Ubuntu as its base.
|
||||
|
||||
On the other hand, Fedora is a cutting-edge distribution that focuses on incorporating exciting changes that eventually makes it way to Red Hat Enterprise Linux (RHEL).
|
||||
|
||||
Unlike Linux Mint, Fedora does not exclusively focus on personal use (or non-developers). Even though they offer a workstation edition, they aim for developers and experienced Linux users.
|
||||
|
||||
### Fedora or Mint: What Should You Go For?
|
||||
|
||||
While we know that Fedora is not exactly geared towards Linux newbies, many users love using Fedora as their daily driver. So, in this article, we shall shed light on some differences between the two to help you pick one to use on your desktop machine.
|
||||
|
||||
#### System Requirements & Hardware Compatibility
|
||||
|
||||
![][3]
|
||||
|
||||
Before choosing any Linux distribution, you should always go through the system requirements and check the hardware compatibility.
|
||||
|
||||
Here, both Linux Mint and Fedora require at least 2 GB of RAM, 20 GB of disk space, and a 1024 x 768 resolution display to get an entry-level experience.
|
||||
|
||||
Yes, the official documentation may mention 1 GB of RAM to start with but let us be practical of your use-case. Unless you have a vintage computer that you want to revive for a specific purpose, it is out of the equation.
|
||||
|
||||
![Linux Mint Resource Usage][4]
|
||||
|
||||
Technically, both support modern and old hardware. You will only know how it works along with the software/driver support when you get it installed. Unless you have a special peripheral or hardware component with specific features, hardware support may not be a big deal.
|
||||
|
||||
Linux Mint 19 series still provide support for 32-bit systems and you can use it till April 2023. Fedora doesn’t support 32-bit systems anymore.
|
||||
|
||||
#### Software Update Cycle
|
||||
|
||||
![Linux Mint Update Manager][5]
|
||||
|
||||
Linux Mint focuses on Long-Term Releases (LTS) with a five-year support. It will be maintained same as Ubuntu. But there is no paid extension like Ubuntu offers.
|
||||
|
||||
Fedora does not offer an LTS release but pushes a new update every 6 months. Every version gets software support for 13 months. You get the ability to skip one version if you want.
|
||||
|
||||
If you just want to have a Linux distro installed for years without requiring the latest technology/features in an update, Linux Mint is the way to go.
|
||||
|
||||
But, if you want to the latest and greatest (which can also break your computing experience ins some rare cases) and accept to adapt with the major changes Fedora pushes, Fedora can be a choice.
|
||||
|
||||
#### Desktop Environment Choices
|
||||
|
||||
![Linux Mint Cinnamon Edition][6]
|
||||
|
||||
Linux Mint provides three different [desktop environments][7] — **MATE, Cinnamon, and Xfce**. All of them will have the same update cycle and will be supported for five years from their release.
|
||||
|
||||
Even though Fedora does not offer LTS releases, you get a variety of desktop choices in the form of Fedora spins. You get KDE, LXQt, MATE, Cinnamon, LXDE, and an edition with i3 tiling window manager baked in.
|
||||
|
||||
![Fedora 34 with GNOME 40][8]
|
||||
|
||||
So, if you want more choices out of the box, Fedora can be a quite exciting choice.
|
||||
|
||||
#### Software Availability
|
||||
|
||||
![Linux Mint’s Software Center and Package Manager][9]
|
||||
|
||||
The default repositories of Linux Mint (or Ubuntu’s) offer a wide range of software to install. But Fedora’s default repository sticks only to open-source applications.
|
||||
|
||||
Not just limited to that, Linux Mint also comes packed with [Synaptic Package Manager][10] which is an impressive lightweight tool to install software.
|
||||
|
||||
Even though you can [enable third-party repositories in Fedora][11], it is yet an additional step. Also, the RPM Fusion repository may not be as huge as Ubuntu’s universe repository.
|
||||
|
||||
![Fedora 34 Software Center][12]
|
||||
|
||||
So, with Linux Mint, overall, you get more packages available to install and more ways to install software, out of the box.
|
||||
|
||||
#### Ease of Use & Installation
|
||||
|
||||
For an entirely new user, Ubuntu or any Ubuntu-based distribution generally fares well to start with.
|
||||
|
||||
Starting from the [installation experience in Ubuntu][13] to the ease of [installing software][14] while having the option to opt for an LTS release is what a beginner finds handy.
|
||||
|
||||
And, Linux Mint naturally presents the same benefits of Ubuntu with Ubiquity installer – hence, it offers a minimal learning curve, easy to install and easy to use.
|
||||
|
||||
While Fedora is not complex by definition but the installation options, package manager, and lack of software in the default repositories may prove to be a time-consuming factor.
|
||||
|
||||
If you’ve never tried it, I suggest you to go through our [Fedora installation guide for VirtualBox][15]. It is a good way to test the installation experience before trying it out on your production system of any sort.
|
||||
|
||||
#### Out of the Box Experience
|
||||
|
||||
The most hassle-free experience is usually the pleasant option. Well, for most people.
|
||||
|
||||
Now, you need to understand that depending on the hardware configuration, every user might end up having a different “out-of-the-box” experience.
|
||||
|
||||
But, for a reference, let me just give you my example for both Fedora and Linux Mint.
|
||||
|
||||
Considering I’m rocking an NVIDIA GPU on my PC, I need to install the proprietary drivers for the best performance.
|
||||
|
||||
![][16]
|
||||
|
||||
And, when I booted up Linux Mint, installing the drivers were pretty easy using the **Driver Manager** app.
|
||||
|
||||
But, with Fedora, even though I followed our guide on [installing Nvidia drivers in Fedora][17], I was presented with an error when I rebooted.
|
||||
|
||||
![Installing NVIDIA drivers in Fedora][18]
|
||||
|
||||
Not just that, for some reason, my wired network did not seem to be active – hence, I had no internet connectivity.
|
||||
|
||||
Yes, you should always try to troubleshoot when you run into issues, but I did not need to do that for Linux Mint. So, in my experience, I will recommend Linux Mint with a better out of the experience.
|
||||
|
||||
#### Documentation
|
||||
|
||||
I would recommend going for [Fedora’s documentation][19] if you rely on resources and want to challenge yourself with a decent learning experience along the process.
|
||||
|
||||
You will find up-to-date information for recent and latest Fedora releases, which is a good thing.
|
||||
|
||||
On the other hand, [Linux Mint’s documentation][20] is not regularly updated but useful when you want to dig deeper.
|
||||
|
||||
#### Community Support
|
||||
|
||||
You will get a good community support for both. The [Linux Mint forums][21] is a basic platform which is easy to use and gets the job done.
|
||||
|
||||
[Fedora’s forum][22] is powered by Discourse, which happens to be one of the most [popular modern open-source forum software][23].
|
||||
|
||||
#### Corporate vs Community Angle
|
||||
|
||||
Fedora is backed up by the biggest open-source company [Red Hat][24] – so you get a good level of constant innovation and support for the long run.
|
||||
|
||||
However, just because Fedora is not built for the daily computer users in mind, the choices made with every release may affect your user experience entirely.
|
||||
|
||||
On the other hand, Linux Mint is completely backed up by a passionate Linux community focusing on making Linux easier and reliable for everyday use. Of course, it depends on Ubuntu as the base but Linux Mint does make bold changes if the community does not like something from the upstream.
|
||||
|
||||
For instance, Linux Mint disabled snaps by default unlike official Ubuntu distro. So, you will have to [enable snaps in Linux Mint][25] if you want to use them.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
If you want a no-nonsense and easy to use operating system for your home computer, Linux Mint would be my suggestion. But, if you want to experience the latest and greatest, while taking a little adventure in your Linux learning experience, Fedora can be a good pick.
|
||||
|
||||
While every operating system requires some form of troubleshooting and nothing can guarantee zero issues with your hardware, I think Linux Mint will have potentially no issues for the majority of the users.
|
||||
|
||||
In any case, you can re-visit the comparison points mentioned above to see what matters most for your computer.
|
||||
|
||||
What do you think? Would you pick Fedora over Mint? And, Why? Let me know in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/linux-mint-vs-fedora/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/best-linux-beginners/
|
||||
[2]: https://itsfoss.com/linux-mint-vs-ubuntu/
|
||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-34-about.png?resize=1020%2C709&ssl=1
|
||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-resources.png?resize=800%2C293&ssl=1
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-update-manager.png?resize=819%2C612&ssl=1
|
||||
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-cinnamon-desktop.png?resize=800%2C450&ssl=1
|
||||
[7]: https://itsfoss.com/best-linux-desktop-environments/
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-34-desktop.png?resize=800%2C478&ssl=1
|
||||
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/linux-mint-software-sources.png?resize=800%2C385&ssl=1
|
||||
[10]: https://itsfoss.com/synaptic-package-manager/
|
||||
[11]: https://itsfoss.com/fedora-third-party-repos/
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-34-software.png?resize=1055%2C691&ssl=1
|
||||
[13]: https://itsfoss.com/install-ubuntu/
|
||||
[14]: https://itsfoss.com/remove-install-software-ubuntu/
|
||||
[15]: https://itsfoss.com/install-fedora-in-virtualbox/
|
||||
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/linux-mint-driver-manager.jpg?resize=800%2C548&ssl=1
|
||||
[17]: https://itsfoss.com/install-nvidia-drivers-fedora/
|
||||
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/fedora-nvidia-driver-installation.png?resize=706%2C516&ssl=1
|
||||
[19]: https://docs.fedoraproject.org/en-US/docs/
|
||||
[20]: https://linuxmint.com/documentation.php
|
||||
[21]: https://forums.linuxmint.com
|
||||
[22]: https://ask.fedoraproject.org
|
||||
[23]: https://itsfoss.com/open-source-forum-software/
|
||||
[24]: https://www.redhat.com/en
|
||||
[25]: https://itsfoss.com/enable-snap-support-linux-mint/
|
@ -1,200 +0,0 @@
|
||||
[#]: subject: (Top 5 Chrome-like Browsers That Are Better Than Google Chrome in 2021)
|
||||
[#]: via: (https://news.itsfoss.com/chrome-like-browsers-2021/)
|
||||
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Top 5 Chrome-like Browsers That Are Better Than Google Chrome in 2021
|
||||
======
|
||||
|
||||
Want to switch away from Google? But, looking for something potentially better than Google Chrome (and similar) for your Linux system?
|
||||
|
||||
Fortunately, there are multiple Google Chrome alternatives that you can try.
|
||||
|
||||
Each of them brings something interesting to the table, while also keeping the fantastic compatibility Chrome is known for. Read on to find out more about these browsers.
|
||||
|
||||
### Options That Are Better Than Google Chrome
|
||||
|
||||
**Note:** _While [free and open-source software plays a crucial role in replacing big tech][1], any choice available on Linux other than Google Chrome should be a good start. Hence, you will find some non-FOSS options as well._
|
||||
|
||||
In my opinion, the best alternatives to Chrome are Chromium-based, meaning that they share the same DNA with Chrome. The advantage of this is that they already have feature parity with Chrome, while having more time to add their own.
|
||||
|
||||
Also, if you want, you can explore [opensource alternatives to Chrome][2] that are not based on Chromium.
|
||||
|
||||
In any case, even if the alternatives to Google Chrome do not seem superior to you, it is worth a try to move away from Big Tech.
|
||||
|
||||
The result of this is a collection of browsers that are equal or better than Chrome in various aspects. Without further ado, here are my top five picks for Chrome-like browsers that are better than Chrome itself:
|
||||
|
||||
* **UnGoogled Chromium**
|
||||
* **Brave**
|
||||
* **Microsoft Edge**
|
||||
* **Vivaldi**
|
||||
* **Opera**
|
||||
|
||||
|
||||
|
||||
This list is in no order of ranking.
|
||||
|
||||
### 1\. UnGoogled Chromium
|
||||
|
||||
![][3]
|
||||
|
||||
**Features:**
|
||||
|
||||
* Removal of functionality specific to Google domains.
|
||||
* Blocking of internal requests to Google at runtime.
|
||||
* Stripping Google binaries from the source code.
|
||||
* Many new command-line switches and `chrome://flags` entries.
|
||||
* Forces all pop-ups into tabs.
|
||||
|
||||
|
||||
|
||||
For the privacy fans out there, this browser will be a godsend. While it may look identical to Chrome, it has many privacy tweaks under-the-hood.
|
||||
|
||||
As the name suggests, the biggest setback for Chrome users will be the absence of Google’s service integrations. This also means no more internal requests to Google, Google URL tracking, and much more.
|
||||
|
||||
It does not boast anything extraordinary to protect your privacy, but it should be better than Google Chrome.
|
||||
|
||||
You can choose to explore and toggle privacy settings at will through the Chrome flags settings as well.
|
||||
|
||||
All-in-all, UnGoogled Chromium provides a familiar browsing experience, with a suite of privacy features added in as well. It is reliable and is also compatible with the large ecosystem of Chrome extensions.
|
||||
|
||||
[UnGoogled Chromium][4]
|
||||
|
||||
### 2\. Brave
|
||||
|
||||
![][3]
|
||||
|
||||
**Features:**
|
||||
|
||||
* Built-in ad blocker.
|
||||
* Faster page loading times.
|
||||
* Brave rewards program.
|
||||
* Ability to synchronise between devices.
|
||||
* Chrome web store support.
|
||||
|
||||
|
||||
|
||||
When Brave first marched onto the stage in 2016, people around the world were gawking at its privacy and performance features. At launch, these included a built-in ad-blocker and a new UI.
|
||||
|
||||
Since then, the browser has gained many more features, including a rewards program and [Tor][5] integration. This has led it to become one of the fastest-growing browsers.
|
||||
|
||||
[Brave][6]
|
||||
|
||||
### 3\. Microsoft Edge
|
||||
|
||||
![][3]
|
||||
|
||||
**Features:**
|
||||
|
||||
* Chrome Web Store support
|
||||
* Child browsing mode (additional protection and simpler UI)
|
||||
* Good PDF editing tools
|
||||
* Built-in coupon finder
|
||||
* Reader Mode
|
||||
* Built-in password generator
|
||||
|
||||
|
||||
|
||||
When Microsoft Edge first released alongside Windows 10 in 2015, it was widely criticized for being slow and buggy. However, in early 2020 it was completely remade using the Chromium web engine.
|
||||
|
||||
This is the same engine Chrome is based on. The result of this is a modern and fast browsing experience. One perk of this transition is the web browser’s ability to run on many different platforms, from Windows 7 and macOS to Ubuntu and other Linux-based distros.
|
||||
|
||||
I know, if you hate Microsoft for some reason, this may not entice you – but Microsoft Edge for Linux is a serious alternative to Google Chrome.
|
||||
|
||||
[Microsoft Edge (Beta)][7]
|
||||
|
||||
### 4\. Vivaldi
|
||||
|
||||
![][3]
|
||||
|
||||
**Features:**
|
||||
|
||||
* Built-in translator
|
||||
* Vivaldi Email (Beta)
|
||||
* Feed Reader (Beta)
|
||||
* Vivaldi Calendar (Beta)
|
||||
* Highly customizable UI
|
||||
* Built-in Ad Blocker
|
||||
* Chrome Web Store support
|
||||
* Tab grouping
|
||||
* Split-screen tabs
|
||||
|
||||
|
||||
|
||||
First released in 2016, Vivaldi has quickly risen the ranks in browser wars. Originally designed for Opera users disgruntled by its transition from the [Presto][8] [layout engine][9], it has managed to re-implement many of the features lost during Opera’s transition to Chromium.
|
||||
|
||||
Amazingly, it has managed to do this all while being based on Chromium (the very reason Opera dropped these features).
|
||||
|
||||
The latest [Vivaldi 4.0 release][10] also turned the tables with several features for power users.
|
||||
|
||||
While it isn’t 100% FOSS, 93% of its source code is available, with only the UI being proprietary. Considering Vivaldi’s development team actively focus on Linux users for improvement, this could be a worthy tradeoff due to the sheer number of features Vivaldi offers.
|
||||
|
||||
[Vivaldi][11]
|
||||
|
||||
### 5\. Opera
|
||||
|
||||
![][3]
|
||||
|
||||
**Features:**
|
||||
|
||||
* Built-in VPN
|
||||
* Easy access to social media
|
||||
* Built-in cryptocurrency wallet
|
||||
* Fraud and malware protection
|
||||
* Highly visible website security badge
|
||||
|
||||
|
||||
|
||||
While it has never been the king of web browsers, Opera has always been present in the debate over which browser to use. Originally based on its in-house Presto Layout Engine, it switched over to Chromium in 2013.
|
||||
|
||||
Unfortunately, this switch meant that the Opera team was forced to drop some of its most well-known features, paving the way for alternatives such as Vivaldi and Firefox to fill the space Opera had left.
|
||||
|
||||
That isn’t to say that Opera is without features. It contains many, some of which are listed below.
|
||||
|
||||
[Opera][12]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Here we have listed a wide variety of browsers tailored to all kinds of users on any desktop platform.
|
||||
|
||||
No matter whether you want more features, a better user interface, or something that helps you get away from Google, there is an option for you.
|
||||
|
||||
Since all these browsers are based on Chromium, they all offer a good compatibility and user experience like Chrome. So, switch to one of these Chrome-like browsers and enjoy the freedom that each of them grants!
|
||||
|
||||
_What’s your favorite alternative to Google Chrome on Linux in 2021? Let me know in the comments down 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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/chrome-like-browsers-2021/
|
||||
|
||||
作者:[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://news.itsfoss.com/save-privacy-with-foss/
|
||||
[2]: https://itsfoss.com/open-source-browsers-linux/
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQxNiIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[4]: https://github.com/Eloston/ungoogled-chromium
|
||||
[5]: https://itsfoss.com/tor-guide/
|
||||
[6]: https://brave.com
|
||||
[7]: https://www.microsoftedgeinsider.com/en-us/download
|
||||
[8]: https://en.wikipedia.org/wiki/Presto_(browser_engine)
|
||||
[9]: https://en.wikipedia.org/wiki/Browser_engine
|
||||
[10]: https://news.itsfoss.com/vivaldi-4-0-release/
|
||||
[11]: https://vivaldi.com
|
||||
[12]: https://www.opera.com
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user