mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-21 02:10:11 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into translating
This commit is contained in:
commit
58f7fd7089
186
published/20210630 9 reasons I love to use the Qt Creator IDE.md
Normal file
186
published/20210630 9 reasons I love to use the Qt Creator IDE.md
Normal file
@ -0,0 +1,186 @@
|
||||
[#]: subject: (9 reasons I love to use the Qt Creator IDE)
|
||||
[#]: via: (https://opensource.com/article/21/6/qtcreator)
|
||||
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (hadisi1993)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-14767-1.html)
|
||||
|
||||
我爱用 Qt Creator IDE 的九个原因
|
||||
======
|
||||
|
||||
> Qt Creator 就是丰富的 Qt 库和程序员之间的粘合剂。
|
||||
|
||||

|
||||
|
||||
Qt Creator 是 Qt 框架的默认集成开发环境(IDE),同时也是丰富的 Qt 库和用户之前的粘合剂。除了如智能代码补全、调试、项目管理等基础功能外,Qt Creator 还提供了很多让软件开发变得更简单的特性。
|
||||
|
||||
在这篇文章中,我会重点介绍一些我最喜欢的 [Qt Creator][2] 特性。
|
||||
|
||||
### 深色模式
|
||||
|
||||
当我使用一个新的应用时,我的第一个问题是:_它有深色模式吗?_ Qt Creator 的回答是:_你更喜欢哪一种深色模式呢?_
|
||||
|
||||
你可以在“<ruby>选项<rt>Options</rt></ruby>”菜单中激活深色模式。在顶部的菜单栏中,点击“<ruby>工具<rt>Tools</rt></ruby>”,选择“<ruby>选项<rt>Options</rt></ruby>”,然后转到“<ruby>环境<rt>Environment</rt></ruby>”部分。下面是你能选择的常用外观:
|
||||
|
||||
![QT Creator 深色模式][3]
|
||||
|
||||
### 定制外观
|
||||
|
||||
像每一个 Qt 应用一样,借助样式表,Qt Creator 的外观是高度可定制化的。下面,你可以按照我的做法给 Qt Creator一个想要的外观。
|
||||
|
||||
将下面这些内容写入 `mycustomstylesheet.css` 文件中:
|
||||
|
||||
```
|
||||
QMenuBar { background-color: olive }
|
||||
QMenuBar::item { background-color: olive }
|
||||
QMenu { background-color : beige; color : black }
|
||||
QLabel { color: green }
|
||||
```
|
||||
|
||||
然后使用命令行开启 Qt Creator,将样式表作为参数传入:
|
||||
|
||||
```
|
||||
qtcreator -stylesheet=mycustomstylesheet.css
|
||||
```
|
||||
|
||||
IDE 现在看上去应该会变成这样:
|
||||
|
||||
![QT Creator 定制样式表][5]
|
||||
|
||||
在这份 [文档][6] 中可以查阅更多的样式表。
|
||||
|
||||
### 命令行参数
|
||||
|
||||
Qt Creator 可接受很多命令行选项。例如,如果想在启动时自动加载当前项目,那么你可以将它的路径传入:
|
||||
|
||||
```
|
||||
qtcreator ~/MyProject/MyQtProject.pro
|
||||
```
|
||||
|
||||
你甚至可以将默认应该打开的文件和行数作为参数传递。下面这个命令打开 `main.cpp` 20 行处:
|
||||
|
||||
```
|
||||
qtcreator ~/MyProject/main.cpp:20
|
||||
```
|
||||
|
||||
在这份 [文档][7] 中可以查阅更多 Qt 特有的命令行选项。
|
||||
|
||||
|
||||
Qt Creator 和一般的 Qt 应用无二,所以,除了自己的命令行参数以外,它也接收 [QApplication][8] 和 [QGuiApplication][9] 的一般参数。
|
||||
|
||||
### 交叉编译
|
||||
|
||||
Qt Creator 允许你定义一些被称为“<ruby>配套<rt>Kit</rt></ruby>”的工具链。 “配套” 定义了构建和运行应用所需要的二进制库和 SDK。
|
||||
|
||||
![QT Creator kits][10]
|
||||
|
||||
这使得你通过两次点击,就在完全不同的工具链之间切换。
|
||||
|
||||
![在 Qt Creator 中切换配套][11]
|
||||
|
||||
在这份 [手册][12] 中可以查阅更多关于配套的内容。
|
||||
|
||||
### 分析工具
|
||||
|
||||
Qt Creator 集成了一些最流行的性能分析工具,例如:
|
||||
|
||||
* [Linux 性能分析器][13](需要特定的内核)
|
||||
* [Valgrind][14] 内存分析器
|
||||
* [Clang-Tidy 和 Clazy][15],一种检查 C/C++ 的 <ruby>静态分析器<rt>Linter</rt></ruby>
|
||||
|
||||
![Qt Creator 分析工具][16]
|
||||
|
||||
### 调试器
|
||||
|
||||
在调试方面,Qt Creator 为 GNU Debugger(GDB)配备了一个很好的界面。我喜欢它检查容器类型和创建条件断点的方式,很简单。
|
||||
|
||||
![Qt Creator 调试器][17]
|
||||
|
||||
### FakeVim
|
||||
|
||||
如果你喜欢 Vim,你可以在设置中开启 FakeVim,来像 Vim 一样控制 Qt Creator。点击“<ruby>工具<rt>Tools</rt></ruby>”,选择“<ruby>选项<rt>Options</rt></ruby>”。在 “FakeVim” 选项中,你可以找到许多开关来定制 FakeVim。除了编辑器的功能外,你可以将自己设置的功能和命令关联起来,定制 Vim 命令。
|
||||
|
||||
举个例子,你可以将“<ruby>构建项目<rt>Build Project</rt></ruby>”的功能和 `build` 命令关联到一起:
|
||||
|
||||
![Qt Creator中的FakeVim][18]
|
||||
|
||||
回到编辑器中,当你按下冒号(`:`)并输入 `build`,Qt Creator 利用配置的工具链,开始进行构建:
|
||||
|
||||
![Qt Creator中的FakeVim][19]
|
||||
|
||||
你可以在这份 [文档][20] 中找到 FakeVim 的更多信息。
|
||||
|
||||
### 类检测器
|
||||
|
||||
当使用 C++ 开发时,点击 Qt Creator 右下角的按钮可打开右边的窗口。然后在窗口顶部拉下的菜单中选择“<ruby>大纲<rt>Outline</rt></ruby>”。如果你在左侧窗体中有头文件打开,你可以很好地纵览定义的类和类型。如果你切换到源文件中(`*.cpp`),右侧窗体会列出所有定义的方法,双击其中一个,你可以跳转到这个方法:
|
||||
|
||||
![Qt Creator 中的类列表][21]
|
||||
|
||||
### 项目配置
|
||||
|
||||
Qt Creator 的项目建立在项目目录里的 `*.pro-file` 之上。你可以为你的项目在 `*.pro-file` 中添加定制的配置。我向 `*.pro-file` 中添加了 `my_special_config`,它向编译器的定义添加 `MY_SPECIAL_CONFIG`。
|
||||
|
||||
```
|
||||
QT -= gui
|
||||
|
||||
CONFIG += c++11 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
CONFIG += my_special_config
|
||||
|
||||
my_special_config {
|
||||
DEFINES += MY_SPECIAL_CONFIG
|
||||
}
|
||||
```
|
||||
|
||||
Qt Creator 自动根据当前配置设置代码高亮:
|
||||
|
||||
![Qt Creator 的特殊配置][22]
|
||||
|
||||
`*.pro-file` 使用 [qmake 语言][23] 进行编写。
|
||||
|
||||
### 总结
|
||||
|
||||
这些特性仅仅是 Qt Creators 所提供的特性的冰山一角。初学者们应该不会感到被其众多的功能所淹没,Qt Creator 是一款对初学者很友好的 IDE。它甚至可能是入门 C++ 开发最简单的方式。如果要获得 QT Creator 特性的全面概述,请参考它的 [官方文档][24]。
|
||||
|
||||
*(插图来自 Stephan Avenwedde, [CC BY-SA 4.0][4])*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/qtcreator
|
||||
|
||||
作者:[Stephan Avenwedde][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[hadisi1993](https://github.com/hadisi1993)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/hansic99
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://www.qt.io/product/development-tools
|
||||
[3]: https://opensource.com/sites/default/files/uploads/qt_creator_dark_mode.png ( QT Creator dark mode)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://opensource.com/sites/default/files/uploads/qt_creator_custom_stylesheet2.png (QT Creator custom stylesheet)
|
||||
[6]: https://doc.qt.io/qt-5/stylesheet-reference.html
|
||||
[7]: https://doc.qt.io/qtcreator/creator-cli.html
|
||||
[8]: https://doc.qt.io/qt-5/qapplication.html#QApplication
|
||||
[9]: https://doc.qt.io/qt-5/qguiapplication.html#supported-command-line-options
|
||||
[10]: https://opensource.com/sites/default/files/uploads/qt_creator_cross_compiling.png (QT Creator kits)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/qt_creator_select_kits.png (Switching between Kits in Qt Creator)
|
||||
[12]: https://doc.qt.io/qtcreator/creator-targets.html
|
||||
[13]: https://doc.qt.io/qtcreator/creator-cpu-usage-analyzer.html
|
||||
[14]: https://doc.qt.io/qtcreator/creator-valgrind-overview.html
|
||||
[15]: https://doc.qt.io/qtcreator/creator-clang-tools.html
|
||||
[16]: https://opensource.com/sites/default/files/uploads/qt_creator_analyzer.png (Qt Creator analyzer)
|
||||
[17]: https://opensource.com/sites/default/files/uploads/qt_creator_debugger2.png (Qt Creator debugger)
|
||||
[18]: https://opensource.com/sites/default/files/uploads/qt_creator_fakevim_ex_commands.png (FakeVim in Qt Creator)
|
||||
[19]: https://opensource.com/sites/default/files/uploads/qt_creator_fakevim_build_commands.png (FakeVim in Qt Creator)
|
||||
[20]: https://doc.qt.io/qtcreator/creator-editor-fakevim.html
|
||||
[21]: https://opensource.com/sites/default/files/uploads/qtcreator_class_overview.png (List of classes in Qt Creator)
|
||||
[22]: https://opensource.com/sites/default/files/uploads/qtcreater_special_config.png (Special configuration in Qt Creator)
|
||||
[23]: https://doc.qt.io/qt-5/qmake-language.html
|
||||
[24]: https://doc.qt.io/qtcreator/
|
@ -3,44 +3,42 @@
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14765-1.html"
|
||||
|
||||
我如何使用 LibreOffice 键盘快捷键
|
||||
使用 LibreOffice 键盘快捷键的小技巧
|
||||
======
|
||||
键盘快捷键让我专注于我要传递的内容,而不是它的外观。
|
||||
|
||||
![Programming keyboard.][1]
|
||||

|
||||
|
||||
图片来源:Opensource.com
|
||||
> 键盘快捷键让我专注于我要传递的内容,而不是它的外观。
|
||||
|
||||
从我记事起,我就一直在使用文字处理软件。当文字处理器从直接格式化转向利用样式来改变文本在页面上的显示方式时,这对我的写作有很大的推动作用。
|
||||
|
||||
LibreOffice 提供了多种样式,你可以使用它们来创建各种内容。 LibreOffice 将段落样式应用于文本块,例如正文、列表和代码示例。字符样式类似,只是这些样式适用于段落内的内联词或其他短文本。使用**视图 -> 样式**菜单,或使用 **F11** 键盘快捷键,调出样式选择器。
|
||||
LibreOffice 提供了多种样式,你可以使用它们来创建各种内容。 LibreOffice 将段落样式应用于文本块,例如正文、列表和代码示例。字符样式类似,只是这些样式适用于段落内的内联词或其他短文本。使用“<ruby>视图<rt>View</rt></ruby> -> <ruby>样式<rt>Styles</rt></ruby>”菜单,或使用 `F11` 键盘快捷键,调出样式选择器。
|
||||
|
||||
![Image of LibreOffice styles][2]
|
||||
|
||||
使用样式可以更轻松地编写更长的文档。考虑这个例子:作为咨询实践的一部分,我写了很多工作簿和培训材料。一个工作簿可能有 40 或 60 页长,具体取决于主题,并且可以包含各种内容,例如正文、表格和列表。我的一些技术培训材料可能还包括源代码示例。
|
||||
使用样式可以更轻松地编写更长的文档。看看这个例子:作为咨询实践的一部分,我写了很多工作簿和培训材料。一个工作簿可能有 40 或 60 页长,具体取决于主题,并且可以包含各种内容,例如正文、表格和列表。我的一些技术培训材料可能还包括源代码示例。
|
||||
|
||||
我有一个提供给客户的标准培训集,但我也做定制的培训计划。在处理自定义程序时,我可能会先从另一个工作簿导入文本,然后从那里开始工作。根据客户的不同,我可能还会调整字体和其他样式元素以匹配客户的样式偏好。对于其他材料,我可能需要添加源代码示例。
|
||||
|
||||
要使用直接格式输入示例源代码,我需要设置字体并调整工作簿中每个代码块的边距。如果我后来决定我的工作簿应该为正文文本或源代码示例使用不同的字体,我需要返回并更改所有内容。对于包含多个代码示例的工作簿,这可能需要几个小时来查找每个源代码示例并调整字体和边距以匹配新的首选格式。
|
||||
要使用直接格式输入示例源代码,我需要设置字体并调整工作簿中每个代码块的边距。如果我后来决定我的工作簿应该对正文文本或源代码示例使用不同的字体,我需要返回并更改所有内容。对于包含多个代码示例的工作簿,这可能需要几个小时来查找每个源代码示例并调整字体和边距以匹配新的首选格式。
|
||||
|
||||
但是,通过使用样式,我可以更新定义一次,为正文样式使用不同的字体,并且 LibreOffice Writer 会在所有使用正文样式的地方更新我的文档。同样,我可以调整预格式化文本样式的字体和边距,LibreOffice Writer 会将这种新样式应用到每个具有预格式化文本样式的源代码示例中。这对于其他文本块也是如此,包括标题、源代码、列表以及页眉和页脚。
|
||||
|
||||
|
||||
我最近有了一个好主意,更新 LibreOffice 键盘快捷键以简化我的写作过程。我重新定义了 **Ctrl**+**B** 设置加粗强调字符样式,**Ctrl**+**I** 设置强调字符样式,**Ctrl**+**空格**设置无字符样式。这使我的写作变得更加容易,因为我不必暂停写作,这样我就可以高亮显示一些文本并选择一种新的风格。相反,我可以使用新的 **Ctrl**+**I** 键盘快捷键来设置字符样式,它本质上是斜体文本。之后我输入的任何内容都使用强调样式,直到我按 **Ctrl**+**空格**将字符样式重置为默认的无字符样式。
|
||||
我最近有了一个好主意,更新 LibreOffice 键盘快捷键以简化我的写作过程。我重新定义了 `Ctrl + B` 设置加粗强调字符样式,`Ctrl + I` 设置强调字符样式,`Ctrl + 空格` 设置取消字符样式。这使我的写作变得更加容易,因为我不必暂停写作,这样我就可以高亮显示一些文本并选择一种新的风格。相反,我可以使用新的 `Ctrl + I` 键盘快捷键来设置字符样式,它本质上是斜体文本。之后我输入的任何内容都使用强调样式,直到我按 `Ctrl + 空格` 将字符样式重置为默认的无字符样式。
|
||||
|
||||
![Image of LibreOffice character styles][3]
|
||||
|
||||
如果你想自己设置的,请使用**工具 > 自定义**, 然后单击键盘选项卡以修改的键盘快捷键。
|
||||
如果你想自己设置的,请使用“<ruby>工具<rt>Tools</rt></ruby> -> <ruby>自定义<rt>Customize</rt></ruby>”, 然后单击“<ruby>键盘<rt>Keyboard</rt></ruby>”选项卡以修改键盘快捷键。
|
||||
|
||||
![Image of LibreOffice keyboard customizations][4]
|
||||
|
||||
LibreOffice 通过样式使技术写作变得更加容易。通过利用键盘快捷键,我简化了我的写作方式,让我专注于我要交付的内容,而不是它的外观。稍后我可能会更改格式,但样式保持不变。
|
||||
|
||||
图片来源:(Jim Hall,CC BY-SA 40)
|
||||
*图片来源:(Jim Hall,CC BY-SA 40)*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -49,7 +47,7 @@ via: https://opensource.com/article/22/6/libreoffice-keyboard-shortcuts
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][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/) 荣誉推出
|
||||
|
@ -3,30 +3,31 @@
|
||||
[#]: author: "Laveesh Kocher https://www.opensourceforu.com/author/laveesh-kocher/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14764-1.html"
|
||||
|
||||
7-Zip 的最终版本 22.00 现已推出
|
||||
7-Zip 22.00 最终版现已推出
|
||||
======
|
||||
![7-zip-2200-500x312][1]
|
||||
|
||||
7-Zip 是用于 Windows、Mac 和 Linux 的知名开源文件归档器。它的最新版本 22.00 现已推出。它是 2022 年的第一个稳定版本。上一个版本是 21.07,于 2021 年 12 月发布。7-Zip 的用户可以从官方网站获取该应用的最新版本。下载适用于 Windows 64 位、32 位和 ARM 版本。该应用仍然与过时的 Windows 版本兼容,例如 XP 和 Vista。它还支持所有官方支持的 Windows 版本,包括服务器版本。适用于 Linux 的 7-Zip 22.00 已经可以下载,但 Mac OS 版本还不可用。
|
||||

|
||||
|
||||
7-Zip 22.00 包含一些增强了应用功能的新特性。这个归档器现在支持提取<ruby>苹果文件系统<rt>Apple File System</rt></ruby>(APFS)镜像。几年前,苹果公司在 Mac OS 10.13 和 iOS 中引入了苹果文件系统。该文件系统在设计时就考虑到了闪存(Flash)和固态硬盘(SSD)存锤。
|
||||
7-Zip 是用于 Windows、Mac 和 Linux 的知名开源文件归档器。它的最新版本 22.00 现已推出。它是 2022 年的第一个稳定版本。上一个版本是 21.07,于 2021 年 12 月发布。7-Zip 的用户可以从官方网站获取该应用的最新版本,下载适用于 Windows 64 位、32 位和 ARM 版本。该应用仍然与过时的 Windows 版本兼容,例如 XP 和 Vista。它还支持所有官方支持的 Windows 版本,包括服务器版本。适用于 Linux 的 7-Zip 22.00 已经可以下载,但 Mac OS 版本还不可用。
|
||||
|
||||
7-Zip 22.00 包括对其 TAR 存档支持的多项增强。使用选项 `-ttar -mm=pax` 或 `-ttar -mm=posix`,7-Zip 现在可以创建符合 POSIX 标准的 tar 格式的 TAR 档案。此外,使用选项 `ttar -mm=pax -mtp=3 -mtc -mta`,7-Zip 可以在 tar/pax 存档中存储高精度的文件时间戳。
|
||||
7-Zip 22.00 包含一些增强了应用功能的新特性。这个归档器现在支持提取<ruby>苹果文件系统<rt>Apple File System</rt></ruby>(APFS)镜像。几年前,苹果公司在 Mac OS 10.13 和 iOS 中引入了苹果文件系统。该文件系统在设计时就考虑到了闪存(Flash)和固态硬盘(SSD)存储。
|
||||
|
||||
7-Zip 22.00 包括了对其 TAR 存档支持的多项增强。使用选项 `-ttar -mm=pax` 或 `-ttar -mm=posix`,7-Zip 现在可以创建符合 POSIX 标准的 tar 格式的 TAR 档案。此外,使用选项 `ttar -mm=pax -mtp=3 -mtc -mta`,7-Zip 可以在 tar/pax 存档中存储高精度的文件时间戳。
|
||||
|
||||
最后,Linux 用户可以在 TAR 归档文件中使用以下两个新选项:
|
||||
|
||||
* `snoi`:将所有者/组 ID 保存在存档中,或将所有者/组 ID 从存档复制到提取的文件中。
|
||||
* `snon`:在存档中保留所有者/组的名称。
|
||||
|
||||
适用于 Windows 的 7-Zip 22.00 添加了对 `-snz` 选项的支持,该选项用于传播 Zone。
|
||||
适用于 Windows 的 7-Zip 22.00 添加了对 `-snz` 选项的支持,该选项用于传播区识别符(LCTT 译注:区标识符是微软在 2013 年为 IE 设计的安全功能,它会标记那些用户自网络上所下载的文件,并在用户准备打开时跳出警告)。
|
||||
|
||||
要提取文件,请使用标识符流。出于安全目的,Windows 使用了该流,它可用于确定文件是在本地创建的还是从互联网下载的。
|
||||
|
||||
在“<ruby>添加到存档<rt>add to archive</rt></ruby>”配置对话框中,7-Zip 22.00 包含一个新的选项窗口。它包括用于更改时间戳精度、更改其他与时间相关的配置选项,以及防止更改源文件的最后访问时间的选项。
|
||||
在“<ruby>添加到存档<rt>add to archive</rt></ruby>”配置对话框中,7-Zip 22.00 包含一个新的选项窗口。它包括用于更改时间戳精度、更改其他与时间相关的配置选项,以及防止更改源文件的最后访问时间等选项。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -35,7 +36,7 @@ via: https://www.opensourceforu.com/2022/06/the-final-version-of-7-zip-22-00-is-
|
||||
作者:[Laveesh Kocher][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lkxed](https://github.com/lkxed)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,47 +1,48 @@
|
||||
en[#]: subject: "Linus Torvalds Expects to See Rust Support in the Kernel Soon"
|
||||
[#]: subject: "Linus Torvalds Expects to See Rust Support in the Kernel Soon"
|
||||
[#]: via: "https://news.itsfoss.com/linux-kernel-rust/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14763-1.html"
|
||||
|
||||
Linus Torvalds 暗示很快就可以在内核中看到对 Rust 的支持
|
||||
======
|
||||
正如 Linus Torvalds 所暗示,Linux Kernel 5.20 可能会与对 Rust 的支持一起首次亮相。你怎么看?
|
||||
|
||||
> 正如 Linus Torvalds 所暗示,Linux Kernel 5.20 发布时可能会提供对 Rust 的支持。你怎么看?
|
||||
|
||||
![Linus][1]
|
||||
|
||||
市面上已经有许多用 Rust 重写的开源项目。因此,Rust 一段时间以来被认为是 Linux 内核的第二语言,也就不足为奇了。
|
||||
市面上已经有许多用 Rust 重写的开源项目。因此,如今 Rust 被认为是 Linux 内核的第二语言,也就不足为奇了。
|
||||
|
||||
几天前,在 [Linux 基金会开源峰会][2] 上,Linus Torvals 提到他们预计将在下一个内核版本(即 Linux 内核 5.20)中对 Rust 进行试验。
|
||||
|
||||
如果你不知道,正如 [Phoronix][3] 率先报道的那样,Linux 内核补丁中已经包含了少量的示例驱动程序,以及支持基本的基础设施的 Rust 代码。
|
||||
或许你不知道,正如 [Phoronix][3] 率先报道的那样,Linux 已经有了 Rust 内核补丁,包含了少量的示例驱动程序,以及基本的基础设施的启用代码。
|
||||
|
||||
因此,Linus Torvalds 对可能合并 Rust 支持的暗示,也不足为奇。但是,这无疑是令人兴奋的!
|
||||
|
||||
### 用于 Linux 内核的 Rust
|
||||
|
||||
这么做的最终目标是让 Linux Kernel 变得更好,但它现在仍然处于试运行阶段。
|
||||
这么做的最终目标是让 Linux 内核变得更好,但它现在仍然处于试运行阶段。
|
||||
|
||||
凭借其所有优势,Rust 正日益成为一种流行的编程语言。不要忘记,[System76 也在开发一个用 Rust 编写的新桌面环境][4]。
|
||||
凭借其各种优势,Rust 正日益成为一种流行的编程语言。还记得吗,[System76 也在开发一个用 Rust 编写的新桌面环境][4]。
|
||||
|
||||
然而,并不是所有参与维护 Linux 内核的人都熟悉这种编程语言。
|
||||
|
||||
那么,这会是一个问题吗?
|
||||
|
||||
考虑到内核中还有其他语言,Linus Torvalds 并不认为这是一个大问题。他还提到他希望看到 Rust 成为新的一份子。
|
||||
Linus Torvalds 并不认为这是一个大问题,因为内核中也有其他语言。他还提到希望看到 Rust 成为新的一份子。
|
||||
|
||||
[The Register][5] 报道称,Linus Torvalds 表示会信任维护者,除非他们犯了错误。
|
||||
|
||||
### Linux 5.20:何时发布?
|
||||
|
||||
Linux 内核 5.19 版本将于 7 月底左右发布。因此,5.20 版本的合并窗口应该会在其稳定发布后打开(假设没有意外延迟的话)。
|
||||
Linux 内核 5.19 版本将于 7 月底左右发布。因此,5.20 版本的合并窗口应该会在其稳定版发布后开启(假设没有意外延迟的话)。
|
||||
|
||||
除了 Rust 以外,Linux Kernel 5.20 应该也是对下一代硬件支持的重要更新(包括 RDNA3),同时提供了更多功能。
|
||||
除了 Rust 以外,Linux 内核 5.20 应该也是对包括 RDNA3 在内的下一代硬件支持的重要更新,它同时提供了更多功能。
|
||||
|
||||
*你如何看待 Rust 在不久的将来会进入 Linux 呢?你感到兴奋吗?欢迎在下方评论区告诉我们~*
|
||||
*你如何看待 Rust 将在不久的将来进入 Linux 呢?你感到兴奋吗?欢迎在下方评论区告诉我们~*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -50,7 +51,7 @@ via: https://news.itsfoss.com/linux-kernel-rust/
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lkxed](https://github.com/lkxed)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,103 @@
|
||||
[#]: subject: "KaOS 2022.06 Release Adds KDE Plasma 5.25 and Sets LibreOffice as the Default"
|
||||
[#]: via: "https://news.itsfoss.com/kaos-2022-06-release/"
|
||||
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
KaOS 2022.06 Release Adds KDE Plasma 5.25 and Sets LibreOffice as the Default
|
||||
======
|
||||
KaOS’s latest update improves the welcome experience for new installations and features more upgrades.
|
||||
|
||||
![kaos][1]
|
||||
|
||||
KaOS, the independent distribution featuring KDE has just released version 2022.06. Although this release includes a lot of changes, notable improvements include Plasma 5.25 and the unreleased Calamares 3.3 branch.
|
||||
|
||||
For a little bit of context, KaOS was first created back in 2013. Its initial goals, which continue to this day, are all centered around providing a highly polished and tightly integrated experience with KDE, Qt, and targeting X86_64 architecture.
|
||||
|
||||
This release seeks to enhance the experience of KaOS users. Let’s find out what’s new!
|
||||
|
||||
### What’s New?
|
||||
|
||||
![][2]
|
||||
|
||||
Although there are a lot of changes in this release, there are a select few that will impact you more than others. Some highlights of this release include:
|
||||
|
||||
* KDE Plasma 5.25.1
|
||||
* KDE Frameworks 5.95
|
||||
* KDE Gear 22.04.2
|
||||
* Calamares 3.3
|
||||
* The switch to LibreOffice from Calligra
|
||||
* Linux Kernel 5.17
|
||||
* New package selection (Welcome screen)
|
||||
|
||||
#### The Latest From KDE
|
||||
|
||||
![kde plasma 5.25][3]
|
||||
|
||||
Released just two weeks ago, [KDE Plasma 5.25][4] is the latest and greatest from KDE. Focusing mostly on visual improvements, Plasma 5.25 offers improved gesture support, the ability to add tints to your accent colors, and a significantly improved touch mode. Of course, all these features are available now with KaOS 2022.06.
|
||||
|
||||
All thanks to its rolling-release schedule.
|
||||
|
||||
Alongside the latest plasma version, this version also gets the latest KDE Gear. This is the name given to the suite of KDE Apps. Users of Kdenlive will be pleased to notice initial support for 10-bit color, as well as a revamped render dialog. Kate also received a lot of improvements, and the settings dialog for it is now able to fit on smaller screens.
|
||||
|
||||
A lot of other KDE apps received similar updates, which you should notice throughout your system. Overall, these inclusions should add that extra bit of polish to an already polished system like KaOS.
|
||||
|
||||
#### Calamares 3.3
|
||||
|
||||
Calamares is the app that you use to install KaOS, as well as many other distributions. Although it is usually only seen when installing the OS, it is the first interaction the user has, and is therefore one of the most important parts to get right.
|
||||
|
||||
The installer uses the improvements found in the Calamares 3.3 branch (which hasn’t seen a release yet).
|
||||
|
||||
#### Package Selection Screen
|
||||
|
||||
![][5]
|
||||
|
||||
For new users, KaOS should be easier to set up than before. You get an improved welcome screen to guide you to select the required packages to make things convenient in your system.
|
||||
|
||||
It is also known as the “Coreso” package selection page to help you make some configurations and install the packages you require.
|
||||
|
||||
#### Ditching Calligra in Favor Of LibreOffice as the Default
|
||||
|
||||
Calligra, the office suite by KDE is being ditched with this release. Now that LibreOffice is available as a single Qt application, the KaOS developers feel comfortable replacing Calligra with it.
|
||||
|
||||
This should bring a number of improvements, most notable better support, as well as a more familiar design. Thanks to its huge user base, LibreOffice is also more actively developed, hopefully meaning that users will get new features sooner.
|
||||
|
||||
#### Linux Kernel 5.17
|
||||
|
||||
As a somewhat odd move, KaOS 2022.06 ships with [Linux kernel 5.17.15][6]. Currently, this release is marked as End Of Life (EOL). As a result, users shouldn’t expect any maintenance updates.
|
||||
|
||||
On a more positive note, at least this kernel release brings a few cool improvements. It brings improved GPU support, as well as improvements to a number of laptop models.
|
||||
|
||||
Hopefully, if nothing else, this inclusion should make some devices work better than otherwise, even if it isn’t the latest version.
|
||||
|
||||
### Download KaOS 2022.06
|
||||
|
||||
Overall, KaOS 2022.06 is an impressive release. It manages to provide a large number of improvements.
|
||||
|
||||
If you want to give KaOS a try, feel free to download it from the official website, linked below.
|
||||
|
||||
[KaOS Download][7]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/kaos-2022-06-release/
|
||||
|
||||
作者:[Jacob Crume][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/06/kaOS-ft.jpg
|
||||
[2]: https://news.itsfoss.com/wp-content/uploads/2022/06/kaos-2022-6-1024x561.png
|
||||
[3]: https://news.itsfoss.com/wp-content/uploads/2022/06/apply_global_theme_advanced-1024x903.png
|
||||
[4]: https://news.itsfoss.com/kde-plasma-5-25-release/
|
||||
[5]: https://news.itsfoss.com/wp-content/uploads/2022/06/croeso_packages.png
|
||||
[6]: https://news.itsfoss.com/linux-kernel-5-17-release/
|
||||
[7]: https://kaosx.us/
|
@ -0,0 +1,79 @@
|
||||
[#]: subject: "Red Hat Hires a Blind Software Engineer to Improve Accessibility on Linux Desktop"
|
||||
[#]: via: "https://news.itsfoss.com/red-hat-accessibility-gnome/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Red Hat Hires a Blind Software Engineer to Improve Accessibility on Linux Desktop
|
||||
======
|
||||
Red Hat is hiring a blind software engineer to help with accessibility refinements in GNOME, Fedora, and RHEL. This is a good step by Red Hat.
|
||||
|
||||
![red hat fedora][1]
|
||||
|
||||
Accessibility on a Linux desktop is not one of the strongest points to highlight. However, GNOME, one of the [best desktop environments][2], has managed to do better comparatively (I think).
|
||||
|
||||
In a blog post by **Christian Fredrik Schaller** (Director for Desktop/Graphics, Red Hat), he mentions that they are making serious efforts to improve accessibility.
|
||||
|
||||
Starting with Red Hat hiring **Lukas Tyrychtr**, who is a blind software engineer to lead the effort in improving Red Hat Enterprise Linux, and Fedora Workstation in terms of accessibility.
|
||||
|
||||
Here, let me summarise some of the important parts of the blog post.
|
||||
|
||||
### State of Accessibility in GNOME
|
||||
|
||||
While I mentioned that GNOME managed to have decent accessibility support in the past, Christian mentions what happened over the years:
|
||||
|
||||
> The first concerted effort to support accessibility under Linux was undertaken by Sun Microsystems when they decided to use GNOME for Solaris. Sun put together a team focused on building the pieces to make GNOME 2 fully accessible and worked with hardware makers to make sure things like Braille devices worked well. I even heard claims that GNOME and Linux had the best accessibility of any operating system for a while due to this effort. As Sun started struggling and got acquired by Oracle this accessibility effort eventually trailed off with the community trying to pick up the slack afterwards
|
||||
|
||||
In a nutshell, after GNOME 3, not a lot of concentrated efforts were put into enhancing the accessibility of the GNOME desktop.
|
||||
|
||||
Of course, with every desktop environment release, the community/developers try their best to improve certain aspects, but a dedicated effort wasn’t possible without proper guidance and resources.
|
||||
|
||||
This is where Red Hat comes in.
|
||||
|
||||
Hiring a blind software engineer (with plans for more) is a big deal and should go a long way to improve the state of accessibility on the Linux desktop.
|
||||
|
||||
Christian asked Lukas about it and here’s what he mentions:
|
||||
|
||||
> Generally, the desktop is usable, at least with GTK, Qt and major web browsers and all recent Electron based applications. Yes, accessibility support receives much less testing than I would like, so for example, a segmentation fault with a running screen reader can still unfortunately slip through a GTK release. But, generally, the foundation works well enough. Having more and naturally sounding voices for speech synthesis might help attract more blind users, but convincing all the players is no easy work.
|
||||
|
||||
Overall, the fundamentals/basic options for accessibility are in place, but can use improvements to make it a seamless experience across the platform.
|
||||
|
||||
### Plans for Accessibility Improvements
|
||||
|
||||
With the current efforts, I think GNOME, Fedora Workstation, and RHEL should get meaningful improvements in the coming years.
|
||||
|
||||
But, what kind of enhancements are we looking at?
|
||||
|
||||
You can read the [blog post][3] to get the details, here’s a summary of it:
|
||||
|
||||
* Need for more utilities for accessibility. Currently, it is limited to extremely few tools (Orca, Speakup).
|
||||
* Focusing on applications ported to GTK 4.
|
||||
* Educating developers about focusing on the accessibility of their applications.
|
||||
|
||||
With Red Hat hiring a blind software engineer, I think the developers will be able to identify what to work on and how to improve it.
|
||||
|
||||
Naturally, with more awareness among developers, the entire Linux ecosystem will benefit (not just GNOME).
|
||||
|
||||
But, of course, this is great news for GNOME users and Fedora/RHEL distributions.
|
||||
|
||||
*What do you think about this initiative by Red Hat? Let us know in the comments below.*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/red-hat-accessibility-gnome/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/06/redhat-fedora-acccessibility.png
|
||||
[2]: https://itsfoss.com/best-linux-desktop-environments/
|
||||
[3]: https://fedoramagazine.org/accessibility-in-fedora-workstation/
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://twobithistory.org/2019/11/06/doom-bsp.html"
|
||||
[#]: author: "Two-Bit History https://twobithistory.org"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "aREversez"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
@ -141,7 +141,7 @@ via: https://twobithistory.org/2019/11/06/doom-bsp.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[aREversez](https://github.com/aREversez)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
63
sources/talk/20220627 Accessibility in Fedora Workstation.md
Normal file
63
sources/talk/20220627 Accessibility in Fedora Workstation.md
Normal file
@ -0,0 +1,63 @@
|
||||
[#]: subject: "Accessibility in Fedora Workstation"
|
||||
[#]: via: "https://fedoramagazine.org/accessibility-in-fedora-workstation/"
|
||||
[#]: author: "Christian Fredrik Schaller https://fedoramagazine.org/author/uraeus/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Accessibility in Fedora Workstation
|
||||
======
|
||||
![Accessibility in Fedora Workstation Featured Image][1]
|
||||
|
||||
Photo by [Elizabeth Woolner][2] on [Unsplash][3]
|
||||
|
||||
The first concerted effort to support accessibility under Linux was undertaken by Sun Microsystems when they decided to use GNOME for Solaris. Sun put together a team focused on building the pieces to make GNOME 2 fully accessible and worked with hardware makers to make sure things like Braille devices worked well. I even heard claims that GNOME and Linux had the best accessibility of any operating system for a while due to this effort. As Sun started struggling and got acquired by Oracle this accessibility effort eventually trailed off with the community trying to pick up the slack afterwards. Especially engineers from Igalia were quite active for a while trying to keep the accessibility support working well.
|
||||
|
||||
But over the years we definitely lost a bit of focus on this and we know that various parts of GNOME 3 for instance aren’t great in terms of accessibility. So at Red Hat we have had a lot of focus over the last few years trying to ensure we are mindful about diversity and inclusion when hiring, trying to ensure that we don’t accidentally pre-select against underrepresented groups based on for instance gender or ethnicity. But one area we realized we hadn’t given so much focus recently was around technologies that allowed people with various disabilities to make use of our software. Thus I am very happy to announce that Red Hat has just hired Lukas Tyrychtr, who is a blind software engineer, to lead our effort in making sure Red Hat Enterprise Linux and Fedora Workstation has excellent accessibility support!
|
||||
|
||||
Anyone who has ever worked for a large company knows that getting funding for new initiatives is often hard and can take a lot of time, but I want to highlight how I was extremely positively surprised at how quick and easy it was to get support for hiring Lukas to work on accessibility. When Jiri Eischmann and I sent the request to my manager, Stef Walter, he agreed to champion the same day, and when we then sent it up to Mike McGrath who is the Vice President of Linux Engineering he immediately responded that he would bring this to Tim Cramer who is our Senior Vice President of Software Engineering. Within a few days we had the go ahead to hire Lukas. The fact that everyone just instantly agreed that accessibility is important and something we as a company should do made me incredibly proud to be a Red Hatter.
|
||||
|
||||
What we hope to get from this is not only a better experience for our users, but also to allow even more talented engineers like Lukas to work on Linux and open source software at Red Hat. I thought it would be a good idea here to do a quick interview with Lukas Tyrychtr about the state of accessibility under Linux and what his focus will be.
|
||||
|
||||
Christian: Hi Lukas, first of all welcome as a full time engineer to the team! Can you tell us a little about yourself?
|
||||
|
||||
Lukas: Hi, Christian. For sure. I am a completely blind person who can see some light, but that’s basically it. I started to be interested in computers around 2009 or so, around my 15th or 16th birthday. First, because of circumstances, I started tinkering with Windows, but Linux came shortly after, mainly because of some pretty good friends. Then, after four years the university came and the Linux knowledge paid off, because going through all the theoretical and practical Linux courses there was pretty straightforward (yes, there was no GUI involved, so it was pretty okay, including some custom kernel configuration tinkering). During that time, I was contacted by Red Hat associates whether I’d be willing to help with some accessibility related presentation at our faculty, and that’s how the collaboration began. And, yes, the hire is its current end, but that’s actually, I hope, only the beginning of a long and productive journey.
|
||||
|
||||
Christian: So as a blind person you have first hand experience with the state of accessibility support under Linux. What can you tell us about what works and what doesn’t work?
|
||||
|
||||
Lukas: Generally, things are in pretty good shape. Braille support on text-only consoles basically just always works (except for some SELinux related issues which cropped up). Having speech there is somewhat more challenging, the needed kernel module ([Speakup][4] for the curious among the readers) is not included by all distributions, unfortunately it is not included by Fedora, for example, but Arch Linux has it. When we look at the desktop state of affairs, there is basically only a single screen reader (an application which reads the screen content), called [Orca][5], which might not be the best position in terms of competition, but on the other hand, stealing Orca developers would not be good either. Generally, the desktop is usable, at least with GTK, Qt and major web browsers and all recent Electron based applications. Yes, accessibility support receives much less testing than I would like, so for example, a segmentation fault with a running screen reader can still unfortunately slip through a GTK release. But, generally, the foundation works well enough. Having more and naturally sounding voices for speech synthesis might help attract more blind users, but convincing all the players is no easy work. And then there’s the issue of developer awareness. Yes, everything is in some guidelines like the GNOME ones, however I saw much more often than I’d like to for example a button without any accessibility labels, so I’d like to help all the developers to fix their apps so accessibility regressions don’t get to the users, but this will have to improve slowly, I guess.
|
||||
|
||||
Christian: So you mention Orca, are there other applications being widely used providing accessibility?
|
||||
|
||||
Lukas: Honestly, only a few. There’s Speakup – a kernel module which can read text consoles using speech synthesis, e.g. a screen reader for these, however without something like Espeakup (an Espeak to Speakup bridge) the thing is basically useless, as it by default supports hardware synthesizers, however this piece of hardware is basically a think of the past, e.g. I have never seen one myself. Then, there’s [BRLTTY][6]. This piece of software provides braille output for screen consoles and an API for applications which want to output braille, so the drivers can be implemented only once. And that’s basically it, except for some efforts to create an Orca alternative in Rust, but that’s a really long way off. Of course, utilities for other accessibility needs exist as well, but I don’t know much about these.
|
||||
|
||||
Christian: What is your current focus for things you want to work on both yourself and with the larger team to address?
|
||||
|
||||
Lukas: For now, my focus is to go through the applications which were ported to GTK 4 as a part of the GNOME development cycle and ensure that they work well. It includes adding a lot of missing labels, but in some cases, it will involve bigger changes, for example, GNOME Calendar seems to need much more work. During all that, educating developers should not be forgotten either. With these things out of the way, making sure that no regressions slip to the applications should be addressed by extending the quality assurance and automated continuous integration checks, but that’s a more distant goal.
|
||||
|
||||
Christian: Thank you so much for talking with us Lukas, if there are other people interested in helping out with accessibility in Fedora Workstation what is the best place to reach you?
|
||||
|
||||
Actually for now the easiest way to reach me is by email at [ltyrycht@redhat.com][7]. Be happy to talk to anyone wanting to help with making Workstation great for accessibility.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/accessibility-in-fedora-workstation/
|
||||
|
||||
作者:[Christian Fredrik Schaller][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/uraeus/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2022/06/Accessibility-in-Fedora-Workstation-816x345.jpg
|
||||
[2]: https://unsplash.com/@elizabeth_woolner?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/accessibility?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: http://www.linux-speakup.org/speakup.html
|
||||
[5]: https://wiki.gnome.org/action/show/Projects/Orca?action=show&redirect=Orca
|
||||
[6]: https://brltty.app/
|
||||
[7]: https://fedoramagazine.org/mailto:ltyrycht@redhat.com
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://www.debugpoint.com/2022/05/essential-ubuntu-apps-2022-part-1/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "Donkey"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -0,0 +1,91 @@
|
||||
[#]: subject: "DevSecOps: A Philosophy that Puts Security First"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/devsecops-a-philosophy-that-puts-security-first/"
|
||||
[#]: author: "Jonathan Pereira https://www.opensourceforu.com/author/jonathan-pereira/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
DevSecOps: A Philosophy that Puts Security First
|
||||
======
|
||||
DevOps has helped remove barriers between development and operations, to improve productivity as well as the reliability of software. However, it has fallen short on some aspects such as security, leading to the emergence of the DevSecOps philosophy. Find out more about it in this article.
|
||||
|
||||
![DevSecOps featured][1]
|
||||
|
||||
Though a lot of people understand the security concerns that are inherent in DevOps, most do not know how to overcome the problem. The new security-focused spin-off DevSecOps could solve these problems if implemented properly.
|
||||
|
||||
In order to understand and appreciate DevSecOps, we first need to understand the benefits and the shortcomings of DevOps.
|
||||
|
||||
#### Pros of DevOps
|
||||
|
||||
*Reduced time-to-market:* Not too long ago, it used to take anywhere close to a year or two for a simple software release, with big companies claiming that they would need to estimate time, resources, and the manpower required to complete a task, and so on. Today there are companies that are shipping out software on a daily basis. This has been possible because of the adoption of the DevOps philosophy.
|
||||
|
||||
*Global presence:* DevOps has without a doubt helped companies manage a global presence. Rewinding back a few years, only the major players in the field of software development were able to ship their software across the globe. Today, that has almost entirely changed as a company situated in India can assist a client from any corner of the world. Similarly, Indian customers can get the services of any company located anywhere in the world.
|
||||
|
||||
*Software democratisation:* One of the reasons why companies demanded a lot of time to build software was because they had to literally develop everything from scratch. Every library and all the necessary tools had to be built from the ground up, which was a huge task. But today that has changed completely, as all the required libraries that can perform basic tasks can be used by anyone, and a developer can just start to build on top of these like a matrix. This is a convenience, especially for those who rely heavily on these libraries. A good example of this is what React and Angular have been doing for Web development.
|
||||
|
||||
#### The con: Lagging security practices
|
||||
|
||||
However, software security still lags behind in spite of all the progress that is being made. We get to hear about major data breaches occurring around the world and often in large companies even to this day. One of the biggest data breaches happened at Equifax in 2017 on 13th May and was not discovered until 29th July! Once the breach was discovered, effective action was taken within 24 hours. However, a lot of sensitive data such as credit card details, social security numbers, and other important documents were accessed over the two-month period. According to some estimates, almost half of the American population was impacted.
|
||||
|
||||
#### Damages incurred due to poor security
|
||||
|
||||
In India, awareness about such security concerns is low, so the severity of this might be hard to grasp for us. These types of data breaches tend to occur from time to time in our country as well. Here are some of the major data breaches that have taken place in India just over the last year.
|
||||
|
||||
There was a data breach at Bigbasket in October 2021, which sacrificed the information of over 20 million people. Then there was a breach at Juspay, a payment gateway, in which over 35 million people’s primary information such as names and addresses, as well as financial details such as card numbers and banking credentials were revealed. In a security breach at Dominos, the data of over one million people was put at risk. Another major breach occurred very recently at Air India, where over 4.5 million people were affected.
|
||||
According to research by IBM, it has been found that the average cost of a data breach is over 5 million US dollars. But what is interesting is that it is about 30 times cheaper to fix the defects during the development stage of software, compared to once it goes out into production. Though this is still a considerable amount of money, at least it saves companies from incurring a bigger loss.
|
||||
|
||||
So the people behind the development of DevOps are now fostering a new paradigm or a philosophy, which they term as ‘Dev + Sec + Ops’ (philosophy of integrated security practices within the DevOps process). This basically integrates security practices with the existing DevOps process and philosophy to make sure that security is the most important aspect in every stage of software development, and not an afterthought.
|
||||
|
||||
| Tools available at your disposal |
|
||||
| :- |
|
||||
| Some of the tools that are already being put to use in the DevOps toolchain can be used to manage DevSecOps too. No new tools are needed for DevSecOps. Tools such as Jira, Git, Gradle, and Selenium are a few that can be used for planning, coding, building and testing software. They are used in DevOps but are compliant with DevSecOps as well — it is just a matter of how they are implemented. Tools such as Puppet, Chef, and Sensu can be used for deployment, operation and monitoring (refer to Figure 2). |
|
||||
|
||||
#### What exactly is DevSecOps?
|
||||
|
||||
DevSecOps is still in its early phases and is continuing to mature. There are already a whole bunch of tools available, but there is still plenty of work to be done. The first important aspect that it covers is that it helps in identifying the security issues, unlike in DevOps where these are generally just an afterthought. The security team goes through a higher level of overview and makes sure that security is on point, before giving the final nod in the development process.
|
||||
|
||||
DevSecOps also gives speed and agility to the security team so they can figure out the issues right from the word go rather than finding them at the end. It allows them to respond to the changes rapidly when there are a lot of new laws that have to be abided by such as the General Data Protection Regulation (GDPR). When the security team is involved from the beginning, it helps them to deal with issues more swiftly. More importantly, it helps to create more automated builds, and more QA testing can be done.
|
||||
|
||||
Automating the entire process in DevOps is a very crucial aspect, and is one of the core pillars on which it stands today. The more things can be structured and automated the better the software is, as it tends to be more scalable that way. Automation helps in maintaining better communication between the security and development teams, which is something DevOps has always advocated.
|
||||
|
||||
![Figure 1: Detailed DevOps workflow][2]
|
||||
|
||||
Figure 1 depicts the workflow that DevOps usually advocates, on top of which the layers of security are supposed to be added at the planning stage. This is the stage at which the security team is already thinking about what kind of threat model policies they want to build in, and the issues that they could possibly encounter when deploying the final product.
|
||||
Once the coding pipeline where code is being generated is reached, the static analysis and code reviews are to be done dynamically. When it gets into testing, the security team must make sure that the code is hardened against the known vulnerabilities. This will significantly lower the risk of attacks. Some kind of pen testing can be done while making sure that the security planning happens at the planning stage itself and not at the test stage.
|
||||
|
||||
Once the code is ready to be deployed, it is essential to continuously monitor and assess it for any kind of threats and vulnerabilities so that the application is not impacted. It must also meet all necessary compliances.
|
||||
|
||||
![Figure 2: Integration of various DevOps tools with DevSecOps tools][3]
|
||||
|
||||
#### The benefits of using security as code
|
||||
|
||||
As much as the automation of the entire workflow is important, there is an extent to which it can be done using tools. Managing a single server manually is not a big deal, but to manage tens of thousands of servers together every day can be super challenging. A code can be put in place in the form of an application, which can very easily manage these servers on its own. It can be instructed to do so according to the required security protocol. Let us look at some of the benefits of using security as code.
|
||||
|
||||
*Collaboration:* A code is an unambiguous common language that can be understood by literally everyone, even if a person doesn’t have any prior understanding of it. Anyone can learn to code and it will perform the same way wherever it is implemented. This makes it significantly easier to work with people from all walks of life.
|
||||
|
||||
*Scalability:* It is highly scalable. Irrespective of the number of servers or nodes being managed, a piece of code is going to perform the same way wherever it has been deployed. This leaves almost no room for error and minimises the risk of malfunctions.
|
||||
|
||||
*Visibility:* Since the code is always visible, it can be edited anytime it is necessary to do so. Whenever there is a bug that might cause any kind of hindrance, it can be rectified very easily without any significant damage. It can be altered at will at any given point of time.
|
||||
|
||||
It’s a no-brainer that security shall always be the utmost priority for anything that you do on the Web, and anything that comprises system hardware and software. Weak security can lead to irreversible losses. Hence, it becomes imperative for developers to implement foolproof security using evolving philosophies like DevSecOps.
|
||||
|
||||
*Transcribed and curated by Laveesh Kocher*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/devsecops-a-philosophy-that-puts-security-first/
|
||||
|
||||
作者:[Jonathan Pereira][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/jonathan-pereira/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/DevSecOps-featured.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/05/Figure-1-Detailed-DevOps-workflow.jpg
|
||||
[3]: https://www.opensourceforu.com/wp-content/uploads/2022/05/Figure-2-Integration-of-various-DevOps-tools-with-DevSecOps-tools.jpg
|
@ -0,0 +1,391 @@
|
||||
[#]: subject: "How to Install Docker And Docker Compose In Ubuntu 22.04 LTS"
|
||||
[#]: via: "https://ostechnix.com/install-docker-ubuntu/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install Docker And Docker Compose In Ubuntu 22.04 LTS
|
||||
======
|
||||
A Step By Step Guide To Install Docker Engine With Docker Compose In Ubuntu.
|
||||
|
||||
In this guide, we will see what is **Docker**, how to **install Docker Engine in Ubuntu** Linux. In addition, we will also see how to **install Docker compose**, a tool to define and run multi-container Docker applications.
|
||||
|
||||
This guide has been officially tested on Ubuntu 22.04 LTS. However, it should work on older versions such as 20.04 LTS, and 18.04 LTS. For better security and stability, I recommend you to use the most recent Ubuntu 22.04 LTS version.
|
||||
|
||||
### What Is Docker?
|
||||
|
||||
**Docker** is a fast, lightweight and OS level virtualization technology for developers and system administrators who wants to build an application with all of required dependencies, and ship it out as only one package.
|
||||
|
||||
Unlike other Virtualization methods, such as VMWare, Xen and VirtualBox, there is no need of separate guest operating system for each virtual machine.
|
||||
|
||||
All Docker containers efficiently share the host operating system's Kernel. Each container will run in an isolated userspace in the same operating system.
|
||||
|
||||
Docker containers will also run on any Linux variant. Let us say you're working in Fedora, and I am using Ubuntu. We can still develop, share and distribute the Docker images with each other.
|
||||
|
||||
You don't have to worry about the OS, software, customized settings, or anything. We can continue the development as long as we have Docker installed in our host system. Simply put, Docker will work everywhere!
|
||||
|
||||
You read two terms in the above paragraphs namely **Docker images** and **Docker containers**. You might wonder, what they are and what is the difference between them.
|
||||
|
||||
In layman's terms, a Docker image is a file which describes how a Container should behave, whereas Docker container is the running (or stopped) state of the Docker image.
|
||||
|
||||
Hope you got a basic idea about Docker. Refer official Docker user guide for more details. The link is attached at the end of this guide.
|
||||
|
||||
### Docker Requirements
|
||||
|
||||
To install and configure Docker, your system must meet the following minimum requirements.
|
||||
|
||||
1. 64 bit Linux or Windows operating systems.
|
||||
2. If you're on Linux, the Kernel version should be 3.10 or above.
|
||||
3. An user account with `sudo` privileges.
|
||||
4. VT (virtualization technology) support enabled on your system BIOS. [Read: [How To Find If A CPU Supports Virtualization Technology (VT)][1]]
|
||||
5. Your system should be connected to Internet.
|
||||
|
||||
In Linux, to verify the Kernel and architecture details, run the following command from the Terminal:
|
||||
|
||||
```
|
||||
$ uname -a
|
||||
```
|
||||
|
||||
**Sample Output:**
|
||||
|
||||
```
|
||||
Linux Ubuntu22CT 5.15.35-3-pve #1 SMP PVE 5.15.35-6 (Fri, 17 Jun 2022 13:42:35 +0200) x86_64 x86_64 x86_64 GNU/Linux
|
||||
```
|
||||
|
||||
As you see in the above output, my Ubuntu system's kernel version is **5.15.35-3-pve**and my Ubuntu system's architecture is **64 bit** (**x86_64 x86_64 x86_64 GNU/Linux**). Check the bold letters in the above result.
|
||||
|
||||
**Heads Up:** Here, I am using Ubuntu 22.04 container in **[Proxmox][2]**. This is why you see word "pve" in the kernel version in the above output. If you're using Ubuntu physical (or virtual) machine, you will see **5.15.35-3-generic** as kernel version.
|
||||
|
||||
Well, the Kernel version is higher than the minimum requirement, and the arch is 64 bit. So, we can install and use Docker without any problems.
|
||||
|
||||
Please note that it doesn't matter which Ubuntu OS you use. Also, It doesn't matter whether you use Ubuntu Desktop or Ubuntu Server edition or any other Ubuntu variants such as Lubuntu, Kubuntu, Xubuntu.
|
||||
|
||||
Docker will work just fine as long as your system has the Kernel version 3.10+, and your system's arch is 64 bit.
|
||||
|
||||
### Install Docker In Ubuntu 22.04 LTS
|
||||
|
||||
First of all, update your Ubuntu system.
|
||||
|
||||
#### 1. Update Ubuntu
|
||||
|
||||
Open your Terminal, and run the following commands one by one:
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
```
|
||||
|
||||
```
|
||||
$ sudo apt upgrade
|
||||
```
|
||||
|
||||
```
|
||||
$ sudo apt full-upgrade
|
||||
```
|
||||
|
||||
#### 2. Add Docker Repository
|
||||
|
||||
First of all, install the necessary certificates and to allow apt package manager to use a repository over HTTPS using command:
|
||||
|
||||
```
|
||||
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release
|
||||
```
|
||||
|
||||
Next, add Docker's official GPG key by running the following commands:
|
||||
|
||||
```
|
||||
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
```
|
||||
|
||||
Add the Docker official repository:
|
||||
|
||||
```
|
||||
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
```
|
||||
|
||||
Update Ubuntu sources list using command:
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
```
|
||||
|
||||
#### 3. Install Docker
|
||||
|
||||
Finally, run the following command to install latest Docker CE in Ubuntu 22.04 LTS server:
|
||||
|
||||
```
|
||||
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
```
|
||||
|
||||
![Install Docker In Ubuntu][3]
|
||||
|
||||
You can, of course, install a specific Docker version as well. To check the list of available Docker versions, run:
|
||||
|
||||
```
|
||||
$ apt-cache madison docker-ce
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
docker-ce | 5:20.10.17~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
|
||||
docker-ce | 5:20.10.16~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
|
||||
docker-ce | 5:20.10.15~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
|
||||
docker-ce | 5:20.10.14~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
|
||||
docker-ce | 5:20.10.13~3-0~ubuntu-jammy | https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
|
||||
```
|
||||
|
||||
You can pick any available version from the above list and install it. For instance, to install version **5:20.10.16~3-0~ubuntu-jammy**, run:
|
||||
|
||||
```
|
||||
$ sudo apt install docker-ce=5:20.10.16~3-0~ubuntu-jammy docker-ce-cli=5:20.10.16~3-0~ubuntu-jammy containerd.io
|
||||
```
|
||||
|
||||
Once it is installed, verify if the Docker service is running with command:
|
||||
|
||||
```
|
||||
$ systemctl status docker
|
||||
```
|
||||
|
||||
You'll see an output something like below.
|
||||
|
||||
```
|
||||
* docker.service - Docker Application Container Engine
|
||||
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Mon 2022-06-27 13:07:43 UTC; 3min 4s ago
|
||||
TriggeredBy: * docker.socket
|
||||
Docs: https://docs.docker.com
|
||||
Main PID: 2208 (dockerd)
|
||||
Tasks: 8
|
||||
Memory: 29.6M
|
||||
CPU: 126ms
|
||||
CGroup: /system.slice/docker.service
|
||||
`-2208 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
|
||||
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.071453522Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:>
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.071459974Z" level=info msg="ClientConn switching balancer to \"pick_first\"" >
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.130989294Z" level=info msg="Loading containers: start."
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.187439756Z" level=info msg="Default bridge (docker0) is assigned with an IP a>
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.235966874Z" level=info msg="Loading containers: done."
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.240149866Z" level=warning msg="Not using native diff for overlay2, this may c>
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.240281966Z" level=info msg="Docker daemon" commit=a89b842 graphdriver(s)=over>
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.240386856Z" level=info msg="Daemon has completed initialization"
|
||||
Jun 27 13:07:43 Ubuntu22CT systemd[1]: Started Docker Application Container Engine.
|
||||
Jun 27 13:07:43 Ubuntu22CT dockerd[2208]: time="2022-06-27T13:07:43.276336600Z" level=info msg="API listen on /run/docker.sock"
|
||||
```
|
||||
|
||||
Great! Docker service is up and running!
|
||||
|
||||
If it is not started already, run the following command to start Docker service.
|
||||
|
||||
```
|
||||
$ sudo systemctl start docker
|
||||
```
|
||||
|
||||
Enable Docker service to start automatically on every reboot:
|
||||
|
||||
```
|
||||
$ sudo systemctl enable docker
|
||||
```
|
||||
|
||||
The installed Docker version can be found using command:
|
||||
|
||||
```
|
||||
$ sudo docker version
|
||||
```
|
||||
|
||||
**Sample Output:**
|
||||
|
||||
```
|
||||
Client: Docker Engine - Community
|
||||
Version: 20.10.17
|
||||
API version: 1.41
|
||||
Go version: go1.17.11
|
||||
Git commit: 100c701
|
||||
Built: Mon Jun 6 23:02:46 2022
|
||||
OS/Arch: linux/amd64
|
||||
Context: default
|
||||
Experimental: true
|
||||
|
||||
Server: Docker Engine - Community
|
||||
Engine:
|
||||
Version: 20.10.17
|
||||
API version: 1.41 (minimum version 1.12)
|
||||
Go version: go1.17.11
|
||||
Git commit: a89b842
|
||||
Built: Mon Jun 6 23:00:51 2022
|
||||
OS/Arch: linux/amd64
|
||||
Experimental: false
|
||||
containerd:
|
||||
Version: 1.6.6
|
||||
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
|
||||
runc:
|
||||
Version: 1.1.2
|
||||
GitCommit: v1.1.2-0-ga916309
|
||||
docker-init:
|
||||
Version: 0.19.0
|
||||
GitCommit: de40ad0
|
||||
```
|
||||
|
||||
![Check Docker Version][4]
|
||||
|
||||
#### 4. Testing Docker
|
||||
|
||||
Let us go ahead, and test whether Docker is working or not.
|
||||
|
||||
To do so, run:
|
||||
|
||||
```
|
||||
$ sudo docker run hello-world
|
||||
```
|
||||
|
||||
The above command will download a test Docker image, and execute a sample **hello_world** program inside the container.
|
||||
|
||||
If you see an output something like below, congratulations! Docker is working fine in our Ubuntu system.
|
||||
|
||||
```
|
||||
Unable to find image 'hello-world:latest' locally
|
||||
latest: Pulling from library/hello-world
|
||||
2db29710123e: Pull complete
|
||||
Digest: sha256:13e367d31ae85359f42d637adf6da428f76d75dc9afeb3c21faea0d976f5c651
|
||||
Status: Downloaded newer image for hello-world:latest
|
||||
|
||||
Hello from Docker!
|
||||
This message shows that your installation appears to be working correctly.
|
||||
|
||||
To generate this message, Docker took the following steps:
|
||||
1. The Docker client contacted the Docker daemon.
|
||||
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
|
||||
(amd64)
|
||||
3. The Docker daemon created a new container from that image which runs the
|
||||
executable that produces the output you are currently reading.
|
||||
4. The Docker daemon streamed that output to the Docker client, which sent it
|
||||
to your terminal.
|
||||
|
||||
To try something more ambitious, you can run an Ubuntu container with:
|
||||
$ docker run -it ubuntu bash
|
||||
|
||||
Share images, automate workflows, and more with a free Docker ID:
|
||||
https://hub.docker.com/
|
||||
|
||||
For more examples and ideas, visit:
|
||||
https://docs.docker.com/get-started/
|
||||
```
|
||||
|
||||
![Run Hello World Docker Container][5]
|
||||
|
||||
Great! Docker is ready to use.
|
||||
|
||||
#### 5. Run Docker As Non-root User In Linux (Optional)
|
||||
|
||||
By default, the Docker daemon binds to a Unix socket instead of a TCP port. Since that **Unix socket is owned by the root** user, the Docker daemon will only run as the root user. Hence, the normal users can't perform most Docker commands.
|
||||
|
||||
If you want to run Docker as non-root user in Linux, refer the following guide:
|
||||
|
||||
* [How To Run Docker As Non-root User In Linux][6]
|
||||
|
||||
I personally do not use this and **do not recommend it** as well. If you don't expose your system to Internet, it is fine. However, do not run Docker as non-root user in production system.
|
||||
|
||||
### Install Docker Compose In Ubuntu
|
||||
|
||||
**Docker Compose** is a tool that can be used to define and run multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you can create and start all the services from your configuration.
|
||||
|
||||
We can install Docker Compose using any one of the following methods.
|
||||
|
||||
#### Method 1 - Install Docker Compose Using Binary
|
||||
|
||||
Download the latest Docker Compose from [here][7].
|
||||
|
||||
As of writing this, the latest version was **2.6.1**.
|
||||
|
||||
Run the following command to download latest stable Docker compose file:
|
||||
|
||||
```
|
||||
$ sudo curl -L "https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
If a new version is available, just replace the number **v2.6.1** in the above command with the new version number. Please don't forget to preface **"v"** before the version number.
|
||||
|
||||
Finally, apply executable permissions to the binary using command:
|
||||
|
||||
```
|
||||
$ sudo chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
To check installed docker composer version, run:
|
||||
|
||||
```
|
||||
$ docker-compose version
|
||||
Docker Compose version v2.6.1
|
||||
```
|
||||
|
||||
#### Method 2 - Install Docker Compose Using PiP
|
||||
|
||||
Alternatively, we can install Docker Compose using **PIP**. Pip is a python package manager used to install applications written in Python programming language.
|
||||
|
||||
Refer the following guide to install Pip on your system.
|
||||
|
||||
* [How To Manage Python Packages Using Pip][8]
|
||||
|
||||
Once pip installed, run the following command to install docker compose. The following command is same for all Linux distributions!
|
||||
|
||||
```
|
||||
$ pip install docker-compose
|
||||
```
|
||||
|
||||
After installing Docker Compose, you can check the version with command:
|
||||
|
||||
```
|
||||
$ docker-compose --version
|
||||
```
|
||||
|
||||
You will see an output something like below.
|
||||
|
||||
```
|
||||
docker-compose version 2.6.1, build 8a1c60f6
|
||||
```
|
||||
|
||||
Congratulations! We have successfully installed Docker Community Edition and Docker Compose.
|
||||
|
||||
I installed Docker, now what? Check the next article in this series to learn the Docker basics.
|
||||
|
||||
* [Getting started with Docker][9]
|
||||
|
||||
To install Docker in RPM based systems such as RHEL, Fedora, CentOS, AlmaLinux, Rocky Linux and openSUSE, check the following link.
|
||||
|
||||
* [Install Docker in CentOS][10]
|
||||
|
||||
### Conclusion
|
||||
|
||||
In this guide, we discussed what is Docker and how to install Docker in Ubuntu 22.04 LTS Jammy Jellyfish. Then we learned how to test docker installation by running a hello-world docker image. Finally, we concluded the tutorial by installing Docker compose using two different ways.
|
||||
|
||||
**Resource:**
|
||||
|
||||
* [Docker website][11]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/install-docker-ubuntu/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/how-to-find-if-a-cpu-supports-virtualization-technology-vt/
|
||||
[2]: https://ostechnix.com/install-proxmox-ve/
|
||||
[3]: https://ostechnix.com/wp-content/uploads/2022/06/Install-Docker-In-Ubuntu.png
|
||||
[4]: https://ostechnix.com/wp-content/uploads/2022/06/Check-Docker-Version.png
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/06/Run-Hello-World-Docker-Container.png
|
||||
[6]: https://ostechnix.com/how-to-run-docker-as-non-root-user-in-linux/
|
||||
[7]: https://github.com/docker/compose/releases
|
||||
[8]: https://ostechnix.com/manage-python-packages-using-pip/
|
||||
[9]: https://ostechnix.com/getting-started-with-docker/
|
||||
[10]: https://ostechnix.com/install-docker-centos/
|
||||
[11]: https://www.docker.com/
|
@ -0,0 +1,146 @@
|
||||
[#]: subject: "Make a temporary file on Linux with Bash"
|
||||
[#]: via: "https://opensource.com/article/22/6/make-temporary-file-bash"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Make a temporary file on Linux with Bash
|
||||
======
|
||||
The mktemp command on Fedora-based systems and tempfile on Debian-based systems are specially designed to alleviate that burden by making it easy to create, use, and remove unique files.
|
||||
|
||||
![bash logo on green background][1]
|
||||
|
||||
Image by: Opensource.com
|
||||
|
||||
When programming in the Bash scripting language, you sometimes need to create a temporary file. For instance, you might need to have an intermediary file you can commit to disk so you can process it with another command. It's easy to create a file such as `temp` or anything ending in `.tmp`. However, those names are just as likely to be generated by some other process, so you could accidentally overwrite an existing temporary file. And besides that, you shouldn't have to expend mental effort coming up with names that seem unique. The `mktemp` command on Fedora-based systems and `tempfile` on Debian-based systems are specially designed to alleviate that burden by making it easy to create, use, and remove unique files.
|
||||
|
||||
### Create a temporary file
|
||||
|
||||
Both `mktemp` and `tempfile` create a temporary file as their default action and print the name and location of the file as output:
|
||||
|
||||
```
|
||||
$ tempfile
|
||||
/tmp/fileR5dt6r
|
||||
|
||||
$ mktemp
|
||||
/tmp/tmp.ojEfvMaJEp
|
||||
```
|
||||
|
||||
Unless you specify a different path, the system places temporary files in the `/tmp` directory. For `mktemp`, use the `-p` option to specify a path:
|
||||
|
||||
```
|
||||
$ mktemp -p ~/Demo
|
||||
/home/tux/Demo/tmp.i8NuhzbEJN
|
||||
```
|
||||
|
||||
For `tempfile`, use the `--directory` or `-d` option:
|
||||
|
||||
```
|
||||
$ tempfile --directory ~/Demo/
|
||||
/home/sek/Demo/fileIhg9aX
|
||||
```
|
||||
|
||||
### Find your temporary file
|
||||
|
||||
The problem with using an auto-generated temporary file is that you have no way of knowing what its name is going to be. That's why both commands return the generated file name as output. You can use an interactive shell such as Konsole, GNOME Terminal, or [rxvt][2] to use the filename displayed on your terminal to interact with the file.
|
||||
|
||||
However, if you're writing a script, there's no way for you to intervene by reading the name of the file and using it in the following commands.
|
||||
|
||||
The authors of `mktemp` and `tempfile` thought of that problem, and there's an easy fix. The terminal sends output to a stream called *stdout.*You can capture stdout by setting a variable to the results of a command launched in a subshell:
|
||||
|
||||
```
|
||||
$ TMPFILE=$(mktemp -p ~/Demo)
|
||||
|
||||
$ echo $TMPFILE
|
||||
/home/tux/Demo/tmp.PjP3g6lCq1
|
||||
```
|
||||
|
||||
Use `$TMPFILE` when referring to the file, and it's the same as interacting directly with the file itself.
|
||||
|
||||
### Create a temporary directory with mktemp
|
||||
|
||||
You can also use the `mktemp` command to create a directory instead of a file:
|
||||
|
||||
```
|
||||
$ mktemp --directory -p ~/Demo/
|
||||
/home/tux/Demo/tmp.68ukbuluqI
|
||||
|
||||
$ file /home/tux/Demo/tmp.68ukbuluqI
|
||||
/home/tux/Demo/tmp.68ukbuluqI: directory
|
||||
```
|
||||
|
||||
### Customize temporary names
|
||||
|
||||
Sometimes you might want an element of predictability in even your pseudo-randomly generated filenames. You can customize the names of your temporary files with both commands.
|
||||
|
||||
With `mktemp`, you can add a suffix to your filename:
|
||||
|
||||
```
|
||||
$ mktemp -p ~/Demo/ --suffix .mine
|
||||
/home/tux/Demo/tmp.dufLYfwJLO.mine
|
||||
```
|
||||
|
||||
With `tempfile`, you can set a prefix and a suffix:
|
||||
|
||||
```
|
||||
$ tempfile --directory ~/Demo/ \
|
||||
--prefix tt_ --suffix .mine
|
||||
/home/tux/Demo/tt_0dfu5q.mine
|
||||
```
|
||||
|
||||
### Tempfile as touch
|
||||
|
||||
You can also set a custom name with `tempfile` :
|
||||
|
||||
```
|
||||
$ tempfile --name not_random
|
||||
not_random
|
||||
```
|
||||
|
||||
When you use the `--name` option, it's absolute, ignoring all other forms of customization. In fact, it even ignores the `--directory` option:
|
||||
|
||||
```
|
||||
$ tempfile --directory ~/Demo \
|
||||
--prefix this_is_ --suffix .all \
|
||||
--name not_random_at
|
||||
not_random_at
|
||||
```
|
||||
|
||||
In a way, `tempfile` can be a substitute for `touch` and `test` because it refuses to create a file that already exists:
|
||||
|
||||
```
|
||||
$ tempfile --name example.txt
|
||||
open: file exists
|
||||
```
|
||||
|
||||
The `tempfile` command isn't installed on all Linux distributions by default, so you must ensure that it exists before you use it as a hack around `test` in a script.
|
||||
|
||||
### Install mktemp and tempfile
|
||||
|
||||
[GNU Core Utils][3] includes the `mktemp` command. Major distributions include Core Utils by default (it's the same package that contains `chmod`, `cut`, `du`, and other essential commands).
|
||||
|
||||
The Debian Utils package includes the `tempfile` command and is installed by default on most Debian-based distributions and Slackware Linux.
|
||||
|
||||
### Wrap up
|
||||
|
||||
Temporary files are convenient because there's no confusion about whether they're safe to delete. They're temporary, meant to be used as needed and discarded without a second thought. Use them when you need them, and clear them out when you're done.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/make-temporary-file-bash
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/bash_command_line.png
|
||||
[2]: https://opensource.com/article/19/10/why-use-rxvt-terminal
|
||||
[3]: https://www.gnu.org/software/coreutils/
|
@ -0,0 +1,129 @@
|
||||
[#]: subject: "What is distributed consensus for site reliability engineering?"
|
||||
[#]: via: "https://opensource.com/article/22/6/distributed-consensus-site-reliability-engineering"
|
||||
[#]: author: "Robert Kimani https://opensource.com/users/robert-charles"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
What is distributed consensus for site reliability engineering?
|
||||
======
|
||||
Keeping your infrastructure healthy takes time and attention, but done correctly it's an automated process that keeps your systems running smoothly.
|
||||
|
||||
![drawings of people shapes on green background][1]
|
||||
|
||||
Image by: Opensource.com
|
||||
|
||||
In my [previous article][2], I discussed how to enforce best practices within your infrastructure. A site reliability engineer (SRE) is responsible for reliability, first and foremost, and enforcing policies that help keep things running is essential.
|
||||
|
||||
### Distributed consensus
|
||||
|
||||
With microservices, containers, and cloud native architectures, almost every application today is going to be a distributed application. Distributed consensus is a core technology that powers distributed systems.
|
||||
|
||||
Distributed consensus is a protocol for building reliable distributed systems. You cannot rely on "heartbeats" (signals from your hardware or software to indicate that they're operating normally) because network failures are inevitable.
|
||||
|
||||
There are some inherent problems to highlight when it comes to distributed systems. Hardware will fail. Nodes in a distributed system can randomly fail.
|
||||
|
||||
This is one of the important assumptions you have to make before you design a distributed system. Network outages are inevitable. You cannot always guarantee 100% network connectivity. Finally, you need a consistent view of any node within a distributed system.
|
||||
|
||||
According to the [CAP theorem][3], a distributed system cannot simultaneously have all of these three properties:
|
||||
|
||||
1. Consistency: Consistent views of data at each node. This means that it is possible that you don't see the same data when viewed from 2 different nodes in a distributed system.
|
||||
2. Availability: Refers to the availability of data at each node.
|
||||
3. Partition tolerance: Refers to tolerance to network failures (which results in network partitions).
|
||||
|
||||
Therefore a node needs to have these qualities to function properly.
|
||||
|
||||
Over the years, several protocols have been developed in the area of distributed consensus, including Paxos, [Raft][4], and Zab.
|
||||
|
||||
Paxos, for instance, was one of the original solutions to the distributed consensus problem. In the Paxos algorithm, nodes in a distributed system send a series of proposals with a unique sequence number. When the majority of processes in the distributed system accept the proposal, that proposal wins, and the sender generates a commit message. The key here is that the majority of the processes accept the proposal.
|
||||
|
||||
The strict sequence numbering of proposals is how it avoids duplication of data, and how it solves the problem of ordering.
|
||||
|
||||
### Open source distributed consensus
|
||||
|
||||
You don't have to reinvent the wheel by writing your own distributed consensus code. There are many open source implementations already available, such as the most popular one [Zookeeper][5]. Other implementations are [Consul][6] and [e][7][tcd][8].
|
||||
|
||||
### Designing autoscaling
|
||||
|
||||
Autoscaling is a process by which the number of servers in a server farm are automatically increased or decreased based on the load. The term "server farm" is used here to refer to any pool of servers in a distributed system. These servers are commonly behind a load balancer, as described in my previous article.
|
||||
|
||||
There are numerous benefits to autoscaling, but here are the 4 major ones:
|
||||
|
||||
1. Reduce cost by running only the required servers. For instance, you can automatically remove servers from your pool when the load is relatively low.
|
||||
2. Flexibility to run less time-sensitive workload during low traffic, which is another variation of automatically reducing the number of servers.
|
||||
3. Automatically replace unhealthy servers (most cloud vendors provide this functionality).
|
||||
4. Increase reliability and uptime of your services.
|
||||
|
||||
While there are numerous benefits, there are some inherent problems with autoscaling:
|
||||
|
||||
1. A dependent back-end server or a service can get overwhelmed when you automatically expand your pool of servers. The service that you depend on, for example, the remote service your application connects to, may not be aware of the autoscaling activity of your service.
|
||||
2. Software bugs can trigger the autoscaler to expand the server farm abruptly. This is a dangerous situation that can happen in production systems. A configuration error, for instance, can cause the autoscaler to uncontrollably start new instances.
|
||||
3. Load balancing may not be intelligent enough to consider new servers. For example, a newly added server to the pool usually requires a warm up period before it can actually receive traffic from the load balancer. When the load balancer isn't fully aware of this situation, it can inundate the new server before it's ready.
|
||||
|
||||
### Autoscaling best practices
|
||||
|
||||
Scaling down is more sensitive and dangerous than scaling up. You must fully test all scale-down scenarios.
|
||||
|
||||
Ensure the back-end systems, such as your database, remote web service, and so on, or any external systems that your applications depend on can handle the increased load. You may be automatically adding new servers to your pool to handle increased load, but the remote service that your application depends on may not be aware of this.
|
||||
|
||||
You must configure an upper limit on the number of servers. This is important. You don't want the autoscaler to uncontrollably start new instances.
|
||||
|
||||
Have a "kill switch" you can use to easily stop the autoscaling process. If you hit a bug or configuration error that causes the autoscaler to behave erratically, you need a way to stop it.
|
||||
|
||||
### 3 systems that act in concert for successful autoscaling
|
||||
|
||||
There are three systems to consider for successful implementation of autoscaling:
|
||||
|
||||
1. LoadBalancing: One of the crucial benefits of [load balancing][9] is the ability to minimize latency by routing traffic to the location closest to the user.
|
||||
2. LoadShedding: In order to accept all incoming requests, you only process the ones you can. Drop the excess traffic. Examples of load shedding systems are [Netflix Zuul][10], and [Envoy][11].
|
||||
3. Autoscaling: Based on load, your infrastructure automatically scales up or down.
|
||||
|
||||
When you're designing your distributed applications, think through all the situations your applications might encounter. You should clearly document how load balancing, load shedding, and autoscaling work together to handle all situations.
|
||||
|
||||
### Implementing effective health checks
|
||||
|
||||
The core job of load balancers is to direct traffic to a set of back-end servers. Load balancers need to know which servers are alive and healthy in order for it to successfully direct traffic to them. You can use health checks to determine which servers are healthy and can receive requests.
|
||||
|
||||
Here's what you need to learn about effective health checks:
|
||||
|
||||
* Simple: Monitor for the availability of a back-end server.
|
||||
* Content verification: Send a small request to the back-end server and examine the response. For instance, you could look for a particular string or response code.
|
||||
* Failure: Your server may be up, but the application listening on a particular pod may be down. Or the pod may be listening, but it may not be accepting new connections. A health check must be intelligent enough to identify a problematic back-end server.
|
||||
|
||||
Health checks with sophisticated content verification can increase network traffic. Find the balance between a simple health check (a simple ping, for instance) and a sophisticated content-based health check.
|
||||
|
||||
In general, for a web application, hitting the home page of a web server and looking for a proper HTML response can serve as a reasonable health check. These kinds of checks can be automated using the [curl command][12].
|
||||
|
||||
Whenever you are doing a postmortem analysis of an outage, review your health check policies and determine how fast your load balancer marked a server up or down. This can be very useful to determine your health check policies.
|
||||
|
||||
### Stay healthy
|
||||
|
||||
Keeping your infrastructure healthy takes time and attention, but done correctly it's an automated process that keeps your systems running smoothly. There's yet more to an SRE's job to discuss, but those are topics for my next article.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/distributed-consensus-site-reliability-engineering
|
||||
|
||||
作者:[Robert Kimani][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/robert-charles
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/Community.jpg
|
||||
[2]: https://opensource.com/article/22/6/circuit-breaker-pattern-site-reliability-engineering
|
||||
[3]: https://en.wikipedia.org/wiki/CAP_theorem
|
||||
[4]: https://raft.github.io/
|
||||
[5]: https://zookeeper.apache.org/
|
||||
[6]: https://www.consul.io/
|
||||
[7]: https://etcd.io/
|
||||
[8]: https://etcd.io
|
||||
[9]: https://opensource.com/article/21/4/load-balancing
|
||||
[10]: https://github.com/Netflix/zuul
|
||||
[11]: https://github.com/envoyproxy/envoy
|
||||
[12]: https://opensource.com/article/20/5/curl-cheat-sheet#headers
|
@ -1,197 +0,0 @@
|
||||
[#]: subject: (9 reasons I love to use the Qt Creator IDE)
|
||||
[#]: via: (https://opensource.com/article/21/6/qtcreator)
|
||||
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (hadisi1993)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
9个我爱用Qt Creator IDE的原因
|
||||
======
|
||||
Qt Creator 就是丰富的Qt库和程序员之间的胶水。
|
||||
![坐在窗前用笔记本电脑的商务女性][1]
|
||||
|
||||
Qt Creator 是Ot框架默认的集成开发环境(IDE),同时也是丰富的Qt库和用户之前的胶水。除了如智能代码补全,调试,项目管理等基础功能外,Qt Creator还提供了很多让软件开发变得更简单的特性。
|
||||
|
||||
在这篇文章中,我会重点介绍一些我最喜欢的[Qt Creator][2]特性。
|
||||
### 黑暗模式
|
||||
|
||||
当我使用一个新的应用时,我的第一个问题是:_这里有黑暗模式吗?_ Qt Creator的回答是:_你更喜欢哪一种黑暗模式呢?_
|
||||
|
||||
你可以在选项菜单中激活黑暗模式。在顶部的菜单栏中,点击**工具**,选择**选项**,然后转到**环境**部分。下面是你能选择的常用外观:
|
||||
|
||||
![ QT Creator 黑暗模式][3]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
### 定制外观
|
||||
|
||||
像每一个Qt应用一样,借助样式表,Qt Creator的外观是高度可定制化的。下面,你可以按照我的做法给Qt Creator一个想要的外观。
|
||||
|
||||
将下面这些内容写入`mycustomstylesheet.css`文件中:
|
||||
|
||||
```
|
||||
QMenuBar { background-color: olive }
|
||||
QMenuBar::item { background-color: olive }
|
||||
QMenu { background-color : beige; color : black }
|
||||
QLabel { color: green }
|
||||
```
|
||||
|
||||
然后使用命令行开启Qt Creator,将样式表作为参数传入:
|
||||
|
||||
|
||||
```
|
||||
`qtcreator -stylesheet=mycustomstylesheet.css`
|
||||
```
|
||||
|
||||
IDE现在看上去应该会变成这样:
|
||||
|
||||
![QT Creator 定制样式表][5]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
在这份[文档][6]中可以查阅更多的样式表
|
||||
|
||||
### 命令行参数
|
||||
Qt Creator 可接受很多命令行选项。例如,如果想在启动时自动加载当前项目,那么你可以将它的路径传递给`*.pro-file`:
|
||||
|
||||
```
|
||||
`qtcreator ~/MyProject/MyQtProject.pro`
|
||||
```
|
||||
|
||||
你甚至可以将默认应该打开的文件和行数作为参数传递。下面这个命令在20行处打开`main.cpp`:
|
||||
|
||||
```
|
||||
`qtcreator ~/MyProject/main.cpp:20`
|
||||
```
|
||||
|
||||
在这份[文档][7]中可以查阅更多Qt特有的命令行选项。
|
||||
|
||||
|
||||
Qt Creator和一般的Qt应用无二,所以,除了自己的命令行参数以外,它也接收[QApplication][8]和[QGuiApplication][9]的一般参数。
|
||||
### 交叉编译
|
||||
|
||||
Qt Creator allows you to define several toolchains, called **Kits**. A kit defines the binaries and SDK for building and running an application:
|
||||
Qt Creator允许你定义一些被称为**Kits**的toolchains。一个Kit定义构建和运行应用所需要的二进制库和SDK。
|
||||
![QT Creator kits][10]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
This allows you to switch between completely different toolchains with just two clicks:
|
||||
这使得你通过两次点击,就在完全不同的toolchains之间切换。
|
||||
|
||||
![在Qt Creator中切换Kits][11]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
在这份[手册][12]中可以查阅更多关于Kits的内容。
|
||||
### 分析工具
|
||||
|
||||
Qt Creator集成了一些最流行的性能分析工具,例如:
|
||||
|
||||
* [Linux Performance Analyzer][13] (需要特定的内核)
|
||||
* [Valgrind][14] memory profiler
|
||||
* [Clang-Tidy and Clazy][15], 一种检查C/C++的linter
|
||||
|
||||
|
||||
![Qt Creator性能分析工具][16]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
### 调试器
|
||||
|
||||
在调试方面,Qt Creator为GNU Debugger(GDB)配备了一个很好的界面。我喜欢它检查容器类型和创建条件断点的方式,很简易。
|
||||
|
||||
![Qt Creator 调试器][17]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
### FakeVim
|
||||
|
||||
如果你喜欢Vim,你可以开启在设置中开启FakeVim来像Vim一样控制Qt Creator。点击**工具**并选择**选项**。在**FakeVim**选项中,你可以找到许多开关来定制FakeVim。除了编辑器的功能外,你可以将自己设置的功能和命令关联起来,定制Vim命令。
|
||||
|
||||
举个例子,你可以将**创建项目**的功能和`build`命令关联到一起去:
|
||||
For example, you can map the function **Build Project** to the `build` command:
|
||||
|
||||
![Qt Creator中的FakeVim][18]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
回到编辑器中,当你按下冒号并输入build,Qt Creator利用配置的toolchain,开始进行构建:
|
||||
|
||||
![Qt Creator中的FakeVim][19]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
你可以中这份[文档][20]中找到FakeVim的更多信息。
|
||||
### 类检测器
|
||||
|
||||
当使用C++开发时,点击Qt Creator右下角的按钮可打开右边的窗口。然后在窗口顶部拉下的菜单中选择**轮廓**。如果你在左侧窗体中有头文件打开,你可以很好地纵览定义的类和类型。如果你切换到源文件中(`*.cpp`),右侧窗体会列出所有定义的方法,双击其中一个,你可以跳转到这个方法:
|
||||
![Qt Creator中的类列表][21]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
### 项目配置
|
||||
|
||||
Qt Creator 的项目建立在项目文件里的`*.pro-file`之上。你可以为你的项目在`*.pro-file`中添加你定制的配置。我向`*.pro-file`中添加了`my_special_config`,它向编译器的定义添加`MY_SPECIAL_CONFIG`。
|
||||
|
||||
```
|
||||
QT -= gui
|
||||
|
||||
CONFIG += c++11 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
CONFIG += my_special_config
|
||||
|
||||
my_special_config {
|
||||
DEFINES += MY_SPECIAL_CONFIG
|
||||
}
|
||||
```
|
||||
|
||||
Qt Creator 自动根据当前配置设置代码高亮:
|
||||
![Qt Creator的特殊配置][22]
|
||||
|
||||
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||
|
||||
`*.pro-file` 使用[qmake语言][23]进行编写
|
||||
### Summary
|
||||
这些特性仅仅是Qt Creators提供特性的冰山一角。初学者们应该不会感到被其众多的功能所淹没,Qt Creator是一款对初学者很友好的IDE。它甚至可能是开始C++开发最简单的方式。如果要获得QT Creator特性的全面概述,请参考它的[官方文档][24]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/qtcreator
|
||||
|
||||
作者:[Stephan Avenwedde][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[hadisi1993](https://github.com/hadisi1993)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/hansic99
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://www.qt.io/product/development-tools
|
||||
[3]: https://opensource.com/sites/default/files/uploads/qt_creator_dark_mode.png ( QT Creator dark mode)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://opensource.com/sites/default/files/uploads/qt_creator_custom_stylesheet2.png (QT Creator custom stylesheet)
|
||||
[6]: https://doc.qt.io/qt-5/stylesheet-reference.html
|
||||
[7]: https://doc.qt.io/qtcreator/creator-cli.html
|
||||
[8]: https://doc.qt.io/qt-5/qapplication.html#QApplication
|
||||
[9]: https://doc.qt.io/qt-5/qguiapplication.html#supported-command-line-options
|
||||
[10]: https://opensource.com/sites/default/files/uploads/qt_creator_cross_compiling.png (QT Creator kits)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/qt_creator_select_kits.png (Switching between Kits in Qt Creator)
|
||||
[12]: https://doc.qt.io/qtcreator/creator-targets.html
|
||||
[13]: https://doc.qt.io/qtcreator/creator-cpu-usage-analyzer.html
|
||||
[14]: https://doc.qt.io/qtcreator/creator-valgrind-overview.html
|
||||
[15]: https://doc.qt.io/qtcreator/creator-clang-tools.html
|
||||
[16]: https://opensource.com/sites/default/files/uploads/qt_creator_analyzer.png (Qt Creator analyzer)
|
||||
[17]: https://opensource.com/sites/default/files/uploads/qt_creator_debugger2.png (Qt Creator debugger)
|
||||
[18]: https://opensource.com/sites/default/files/uploads/qt_creator_fakevim_ex_commands.png (FakeVim in Qt Creator)
|
||||
[19]: https://opensource.com/sites/default/files/uploads/qt_creator_fakevim_build_commands.png (FakeVim in Qt Creator)
|
||||
[20]: https://doc.qt.io/qtcreator/creator-editor-fakevim.html
|
||||
[21]: https://opensource.com/sites/default/files/uploads/qtcreator_class_overview.png (List of classes in Qt Creator)
|
||||
[22]: https://opensource.com/sites/default/files/uploads/qtcreater_special_config.png (Special configuration in Qt Creator)
|
||||
[23]: https://doc.qt.io/qt-5/qmake-language.html
|
||||
[24]: https://doc.qt.io/qtcreator/
|
Loading…
Reference in New Issue
Block a user