Merge pull request #21 from LCTT/master

merge
This commit is contained in:
CanYellow 2023-04-05 23:12:42 +08:00 committed by GitHub
commit 87d11870a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
148 changed files with 19329 additions and 3042 deletions

19
Dict.md
View File

@ -21,7 +21,7 @@ LCTT 术语词典
### F
#### Fork
#### Fork:复刻
Fork 行为/操作广泛用于进程管理、版本管理和软件衍生方面。此词汇也长期缺乏确定的译法。
@ -34,7 +34,7 @@ Fork 行为/操作广泛用于进程管理、版本管理和软件衍生方面
### L
#### Live
#### Live:立付
Live 原意多指“现场”、“实时”,在计算机环境中使用时也多引用此意。但对它的翻译就颇费神,因为无论是在 Live Patch还是更多见的 Live USB/CD、Live Session其实都不好翻译为“现场”、“实时”。
@ -46,7 +46,18 @@ Live 原意多指“现场”、“实时”,在计算机环境中使用时也
- 首次链接临场https://linux.cn/article-12854-1.html
- 首次链接立付https://linux.cn/article-15499-1.html
#### Repo/Repository
### P
#### Pod容器荚
在容器环境中使用 Pod 来代表一组容器。最初,我根据 Kubernetes 中大量采用了航海相关的比喻,而将其译为“吊舱”。但根据 Kubernetes [文档](https://kubernetes.io/docs/concepts/workloads/pods/#:~:text=A%20Pod%20(as%20in%20a,run%20in%20a%20shared%20context.),其来自对 “<ruby>鲸鱼荚<rt>Pod of Whales</rt></ruby>”、“<ruby>豌豆荚<rt>pea pod</rt></ruby>” 的比喻。因此这个词翻译为“容器荚”。也有有将其翻译为“容器组”。
- 提议者wxy
- 首次链接https://linux.cn/article-14591-1.html
### R
#### Repo/Repository代码仓库、软件仓库
Repository 主要用于两个场景,一个是用于版本管理的代码仓库,一个是用于分发软件/组件/制品的软件仓库。
@ -76,4 +87,4 @@ Shell 是 Unix/Linux 等系统的 `sh`、`bash` 等命令行的接口程序,
### 说明
此文档会根据建议不断更新,其固定地址为: https://github.com/LCTT/TranslateProject/blob/master/Dict.md ,欢迎大家提交议题或拉取请求来完善它。
此文档会根据建议不断更新,其固定地址为: https://github.com/LCTT/TranslateProject/blob/master/Dict.md ,欢迎大家提交议题或拉取请求来完善它。

View File

@ -0,0 +1,204 @@
[#]: subject: "Write your first CI/CD pipeline in Kubernetes with Tekton"
[#]: via: "https://opensource.com/article/21/11/cicd-pipeline-kubernetes-tekton"
[#]: author: "Savita Ashture https://opensource.com/users/savita-ashture"
[#]: collector: "lujun9972"
[#]: translator: "lxbwolf"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15681-1.html"
用 Tekton 在 Kubernetes 中编写你的第一条 CI/CD 流水线
======
> Tekton 是一个用于创建持续集成和持续交付CI/CD系统的 Kubernetes 原生开源框架。
![][0]
Tekton 是一个用于创建持续集成和持续交付CI/CD系统的 Kubernetes 原生开源框架。通过对底层实施细节的抽象,它还可以帮助你在多个云供应商或企业内部系统中进行端到端(构建、测试、部署)应用开发。
### Tekton 介绍
[Tekton][2] 最初被称为 [Knative Build][3],后来被重组为独立的开源项目,有自己的 [治理组织][4],现在是属于 [Linux 基金会][5] 的项目。Tekton 提供了一个集群内的容器镜像构建和部署工作流程,换句话说,它是一个 <ruby>持续集成<rt>continuous integration</rt></ruby>CI<ruby>持续交付<rt>continuous delivery</rt></ruby>CD服务。它由 Tekton 流水线和几个支持组件如 Tekton CLI、Triggers 和 Catalog 等组成。
Tekton 是一个 Kubernetes 原生应用。它在 Kubernetes 集群中作为扩展被安装和运行由一套Kubernetes 定制化资源组成,定义了你为流水线创建和复用的构建块。由于 Tekton 是一种 Kubernetes 原生技术,所以它非常容易扩展。当你需要增加你的工作负载时,你只需向你的集群添加节点就可以了。由于其可扩展的设计和社区贡献的组件库,它也很容易定制。
对于需要 CI/CD 系统来开展工作的开发人员,和为其组织内的开发人员建立 CI/CD 系统的平台工程师Tekton 是理想选择。
### Tekton 组件
构建 CI/CD 流水线的过程非常复杂,因此 Tekton 为每一步都提供工具。以下是 Tekton 提供的主要组件:
* <ruby>流水线<rt></rt>Pipeline</rt></ruby> 定义了一组 Kubernetes [自定义资源][6],作为你用来组装 CI/CD 流水线的构建块。
* <ruby>触发器<rt>Triggers</rt></ruby>:一种 Kubernetes 自定义资源,允许你根据从事件有效载荷中提取的信息来创建流水线。例如,你可以在每次创建 Git 仓库的合并请求时,触发流水线的实例化和执行。
* <ruby>命令行<rt>CLI</rt></ruby>:提供一个名为 `tkn` 的命令行界面,你可以使用它从终端与 Tekton 进行交互。
* <ruby>仪表盘<rt>Dashboard</rt></ruby>:是 Tekton 流水线的一个基于网页的图形界面,显示流水线的执行信息。
* <ruby>目录<rt>Catalog</rt></ruby>:是一个高质量的、由社区贡献的 Tekton 构建块(任务、流水线等),可在你自己的流水线中使用。
* <ruby>中心<rt>Hub</rt></ruby>:是一个基于网页的图形界面,用于访问 Tekton 目录。
* <ruby>操作员<rt>Operator</rt></ruby>:是一种 Kubernetes [操作员模式][7],你可以在 Kubernetes 集群中安装、更新、升级和删除 Tekton 项目。
* <ruby><rt>Chains</rt></ruby>:是一个 Kubernetes <ruby>自定义资源定义<rt>Custom Resource Definition</rt></ruby>CRD控制器使你可以在 Tekton 中处理供应链安全的问题。正在开发中。
* <ruby>结果<rt>Results</rt></ruby>:旨在帮助用户对 CI/CD 工作负载历史进行逻辑分组,并将长期结果的存储从流水线控制器中分离出来。
### Tekton 术语
![Tekton terminology][8]
* <ruby>步骤<rt>Step</rt></ruby>:是 CI/CD 工作流程中最基本的实体,例如为 Python 网络应用程序运行一些单元测试或编译一个 Java 程序。Tekton 使用容器镜像执行每个步骤。
* <ruby>任务<rt>Task</rt></ruby>:** 是按特定顺序排列的步骤的集合。Tekton 以 [Kubernetes 容器荚][10] 的形式运行任务,其中每个步骤都成为 <ruby>容器荚<rt>pod</rt></ruby> 中的一个运行容器。
* <ruby>流水线<rt>Pipelines</rt></ruby>是按特定顺序排列的任务的集合。Tekton 把所有任务连接成一个 <ruby>有向无环图<rt>directed acyclic graph</rt></ruby>DAG并按顺序执行图。换句话说它创建了一些 Kubernetes 容器荚,并确保每个容器荚按预期成功运行。
![Tekton pipelines][11]
* <ruby>流水线运行<rt>PipelineRun</rt></ruby>:顾名思义,是一条流水线的具体执行。
* <ruby>任务运行<rt>TaskRun</rt></ruby>:是一个任务的具体执行。你可以选择在流水线外运行一次任务运行,可以通过它查看任务中每个步骤执行的具体情况。
### 创建你的 CI/CD 流水线
开始使用 Tekton 的最简单方法是自己编写一个简单的流水线。如果你每天都在使用 Kubernetes那你可能对 YAML 很熟悉,这正是 Tekton 流水线的定义方式。下面是一个克隆代码库的简单流水线的例子。
首先,创建一个 `task.yaml` 文件,用你喜欢的文本编辑器打开它。这个文件定义了你要执行的 <ruby>步骤<rt>Step</rt></ruby>。在这个例子中,就是克隆一个仓库,所以我把这个步骤命名为 “clone”。该文件设置了一些环境变量然后使用一个简单的 shell 脚本来执行克隆。
接下来是 <ruby>任务<rt>Task</rt></ruby>。你可以把步骤看作是一个被任务调用的函数,而任务则设置步骤所需的参数和工作空间。
```
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
 name: git-clone
spec:
 workspaces:
   - name: output
     description: The git repo will be cloned onto the volume backing this Workspace.
 params:
   - name: url
     description: Repository URL to clone from.
     type: string
   - name: revision
     description: Revision to checkout. (branch, tag, sha, ref, etc...)
     type: string
     default: ""
 steps:
   - name: clone
     image: "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.21.0"
     env:
       - name: PARAM_URL
         value: $(params.url)
       - name: PARAM_REVISION
         value: $(params.revision)
       - name: WORKSPACE_OUTPUT_PATH
         value: $(workspaces.output.path)
     script: |
      #!/usr/bin/env sh
       set -eu
       CHECKOUT_DIR="${WORKSPACE_OUTPUT_PATH}"
       /ko-app/git-init \
         -url="${PARAM_URL}" \
         -revision="${PARAM_REVISION}" \
         -path="${CHECKOUT_DIR}"
       cd "${CHECKOUT_DIR}"
       EXIT_CODE="$?"
       if [ "${EXIT_CODE}" != 0 ] ; then
         exit "${EXIT_CODE}"
       fi
       # Verify clone is success by reading readme file.
       cat ${CHECKOUT_DIR}/README.md
```
创建第二个文件 `pipeline.yaml`,并用你喜欢的文本编辑器打开它。这个文件通过设置诸如可以运行和处理任务的工作区等重要参数来定义流水线。
```
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
 name: cat-branch-readme
spec:
 params:
   - name: repo-url
     type: string
     description: The git repository URL to clone from.
   - name: branch-name
     type: string
     description: The git branch to clone.
 workspaces:
   - name: shared-data
     description: |
      This workspace will receive the cloned git repo and be passed
       to the next Task for the repo's README.md file to be read.
 tasks:
   - name: fetch-repo
     taskRef:
       name: git-clone
     workspaces:
       - name: output
         workspace: shared-data
     params:
       - name: url
         value: $(params.repo-url)
       - name: revision
         value: $(params.branch-name)
```
最后,创建一个 `pipelinerun.yaml` 文件,用喜欢的文本编辑器打开它。这个文件真正的运行流水线。它调用流水线中定义的参数(继而调用任务文件中定义的任务)。
```
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
 name: git-clone-checking-out-a-branch
spec:
 pipelineRef:
   name: cat-branch-readme
 workspaces:
   - name: shared-data
     volumeClaimTemplate:
       spec:
         accessModes:
          - ReadWriteOnce
         resources:
           requests:
             storage: 1Gi
 params:
   - name: repo-url
     value: <https://github.com/tektoncd/pipeline.git>
   - name: branch-name
     value: release-v0.12.x
```
把不同工作分在不同的文件中的好处是,`git-clone` 任务可以在多条流水线中复用。
例如,假设你想为一个流水线项目做端到端的测试。你可以使用 `git-clone` 任务 **来让每一次测试都基于最新的代码**
### 总结
只要你熟悉 Kubernetes那 Tekton 对你来说就像其他 Kubernetes 原生应用一样简单。它有很多工具可以帮助你创建流水线并与之交互。如果你喜欢自动化,不妨试试 Tekton!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/11/cicd-pipeline-kubernetes-tekton
作者:[Savita Ashture][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/savita-ashture
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions)
[2]: https://github.com/tektoncd/pipeline
[3]: https://github.com/knative/build
[4]: https://cd.foundation/
[5]: https://www.linuxfoundation.org/projects/
[6]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
[7]: https://operatorhub.io/what-is-an-operator
[8]: https://opensource.com/sites/default/files/uploads/tekto-terminology.png (Tekton terminology)
[9]: https://tekton.dev/docs/concepts/concept-tasks-pipelines.png
[10]: https://kubebyexample.com/en/concept/pods
[11]: https://opensource.com/sites/default/files/uploads/tekton-pipelines.png (Tekton pipelines)
[12]: https://tekton.dev/docs/concepts/concept-runs.png
[0]: https://img.linux.net.cn/data/attachment/album/202304/01/180822blxgx0c1k43n4kl4.jpg

View File

@ -0,0 +1,94 @@
[#]: collector: (lujun9972)
[#]: translator: (CanYellow)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-15642-1.html)
[#]: subject: (Roy Fielding's Misappropriated REST Dissertation)
[#]: via: (https://twobithistory.org/2020/06/28/rest.html)
[#]: author: (Two-Bit History https://twobithistory.org)
被误用的罗伊·菲尔丁的有关描述性状态迁移REST的博士论文
======
![][0]
符合 <ruby>描述性状态迁移<rt>REpresentational State Transfer</rt></ruby>LCTT 译注REST译自审定公布名词数据库的应用程序接口API无处不在。有趣的是又有多少人真正了解“符合描述性状态迁移”的应有之义呢
大概我们中的大多数人都会跟 [黑客新闻网站上的这篇公开问答][1] 产生共鸣:
> 我阅读了几篇介绍描述性状态迁移REST的文章甚至包括原始论文的部分章节。然而我仍然对REST 到底是什么只有一个相当模糊的想法。我开始认为没有人真的了解它,它仅仅是一个定义相当不充分的概念。
我曾经计划写一篇有关 REST 的博客,在里面探讨 REST 是如何成为这样一个在网络通信领域占主导地位的范式的。我通过阅读 [2000 年发表的 <ruby>罗伊·菲尔丁<rt>Roy Fielding</rt></ruby> 的博士论文][2] 开始我的研究,这篇博士论文向世人介绍了 REST 的概念。在读过菲尔丁的博士论文以后,我意识到,相比之下,更引人注意的是菲尔丁的理论缘何受到如此普遍的误解。
(相对公平地说,)很多人知道 REST 源自菲尔丁的博士论文,但并没有读过该论文。因此对于这篇博士论文的原始内容的误解才得以流行。
最大的误解是:这篇博士论文直接解决了构建 APIAPI的问题我此前一直认为 REST 从一开始就打算成为构建在超文本传输协议HTTP之上的 <ruby>网络 API<rt>Web API</rt></ruby>的架构模型,我相信很多人也这样认为。我猜测此前可能存在一个混乱的试验时期,开发人员采用完全错误的方式在 HTTP 基础上开发 API然后菲尔丁出现了并提出了将 REST 做为网络应用程序开发的正确方式。但是这种想法的时间线对不上:我们今天所熟知的网络服务的 API 并非是在菲尔丁出版他的博士论文之后才出现的新生事物。
菲尔丁的博士论文《架构风格与基于网络的软件架构设计》不是讨论如何在 HTTP 的基础上构建 API而恰恰是讨论 HTTP 本身。菲尔丁是 HTTP/1.0 版规范的贡献者,同时也是 HTTP/1.1 版的共同作者。有感于从 HTTP 的设计中获得的架构经验,他的博士论文将 REST 视为指导 HTTP/1.1 的标准化过程的架构原则的精华。举例而言,他拒绝了使用新的 `MGET``MHEAD` 方法进行批量请求的提议,因为他认为这违反了 REST 所定义的约束条件,尤其是在一个符合 REST 的系统中传递的消息应该是易于代理和缓存的约束条件。[^1] 因此HTTP/1.1 转而围绕持久性连接设计,在此基础上可以发送多个 HTTP 请求。(菲尔丁同时认为网页保存在本地的浏览数据,即 cookie 是不符合 REST 的,因为它们在一个状态无关的系统中增加了状态描述,然而它们的应用已经根深蒂固了。[^2]菲尔丁认为REST 并非构建基于 HTTP 的系统的操作指南,而是扩展 HTTP 的操作指南。
这并不意味着菲尔丁认为 REST 不能用于构建其他系统。只是他假定其他系统也是 “<ruby>分布式超媒体系统<rt>distributed hypermedia systems</rt></ruby>”。人们对 REST 还有另一个误解:认为它是一个可以用在任何网络应用中的通用架构。但是从这篇博士论文中菲尔丁介绍 REST 的部分你基本上能够得出如下的结论,“请注意,我们只设计了 HTTP但是如果你发现你自己也在设计一个_分布式超媒体系统_你也应该采用我们提出的称为 REST 的优秀架构,以让开发变得更容易”。有鉴于互联网已经存在了,我们尚不清楚为什么菲尔丁认为有人可能试图重新创建这样一个(和 HTTP 一样的)系统。或许在 2000 年的时候世界上仍然存在不只一个分布式超文本系统的空间吧。无论如何菲尔丁已经说得很清楚了REST 意在提供一套解决方案来解决在试图经由网络连接超文本内容时出现的可扩展性与一致性问题_而不是_ 作为分布式应用的通用架构模型。
我们现在只记得菲尔丁的博士论文提出了 REST 的概念,但事实上,他的博士论文是在讨论一刀切的软件架构有多么糟糕,以及如何更好地选择符合你需求的软件架构。这篇博士论文中仅用了一个章节来讨论 REST 本身,大量的文本内容都都花在了对你能够在网络应用中运用的不同的架构风格 [^3] 的分类上。这些架构风格包括:受 Unix 的管道设计启发的 <ruby>管道-过滤器<rt>Pipe-and-Filter</rt></ruby> PF风格<ruby>客户-服务器<rt>Client-Server</rt></ruby> CS风格的多种改进<ruby>分层-客户-服务器<rt>Layered-Client-Server</rt></ruby>LCS风格、<ruby>客户-缓存-无状态-服务器<rt>Client-Cache-Stateless-Server</rt></ruby>C\$SS风格和<ruby>分层-客户-缓存-无状态-服务器<rt>Layered-Client-Cache-Stateless-Server</rt></ruby>LC\$SS。这些缩略词未必实用但是菲尔丁认为我们可以通过混合匹配现有风格提供的约束条件来派生出新的风格。REST 就是通过这种方式产生的,它本可以称之为 <ruby>一致性-分层-按需代码-客户-缓存-无状态-服务器<rt>Uniform-Layered-Code-on-Demand-Client-Cache-Stateless-Server</rt></ruby>ULCODC\$SS风格显然我们并没有这样做。菲尔丁建立上述分类是为了强调每一种风格对应的约束适用于不同的应用而上述最后一种风格对应的约束是他所认为的最适用于 HTTP 的。
今天REST 的无处不在是极具讽刺意味的。REST 在各种各样的网络应用中被盲目使用,但是菲尔丁最初只是将 REST 视作一种指引,通过它指导人们裁剪一种软件架构来适应独立应用的特殊需求。
我很难弄清楚这是如何发生的,毕竟菲尔丁已经明确地指出了不能让形式服从功能的陷阱。他在论文的一开始就作出了警告:由于没有正确地理解软件架构而“使用流行的架构设计是经常发生的”[^4]。他在几页之后又重新强调了这一点:
> 一些架构风格经常被描述为适用于一切软件形式的“银弹”解决方案。然而,一名好的设计者应该选择能够满足解决特定问题的需要的架构风格[^5]。
REST 本身就是一个特别糟糕的 “银弹” 解决方案。正如菲尔丁所指出的,它包含了可能不合适的利弊权衡,除非你试图构建一个分布式超媒体应用:
> REST 设计用来高效地进行大粒度的超媒体数据传输,并对网络应用场景中的常用见情形做了优化,但是可能会导致其在与其他形式的软件架构相互作用时不协调。[^6]
菲尔丁提出 REST 是因为网络发展带来了“<ruby>超越政府的可扩展性<rt>anarchic scalability</rt></ruby>”这一棘手问题菲尔丁的意思是需要以一种高性能的方式跨越组织和国家边界连接文件。REST 所施加的约束是经过精心选择的以用来解决这一“超越政府的扩展性”问题。_面向公众_ 的网络服务 API 同样需要解决类似的问题,因此可以理解为什么 REST 在这些应用中是适用的。然而,时至今日,如果发现一个工程团队使用 REST 构建了一个后端,即使这个后端只与工程团队完全控制的客户端通讯,也不会令人惊讶。我们都成为了 [<ruby>蒙蒂巨蟒<rt>Monty Python</rt></ruby> 的独幕滑稽剧][9] 中的建筑师那位建筑师按照屠宰场的风格设计了一座公寓大楼因为屠宰场是他唯一具有的经验的建筑。菲尔丁使用了这部滑稽剧中的一句台词作为他的博士论文的题词打扰一下你说的是“刀”吗LCTT 校注顺便说一句Python 语言的名称来自于 “Monty Python” 这个英国超现实幽默表演团体的名字。)
有鉴于菲尔丁的博士论文一直在极力避免提供一种放之四海而皆准的软件架构REST 又怎么会成为所有网络服务的事实上的标准呢?
我认为,在 21 世纪头十年的中期人们已经厌倦了简单对象访问协议SOAP因此想要创造另一种属于他们自己的四字首字母缩略词。
我只是半开玩笑。<ruby>简单对象访问协议<rt>Simple Object Access Protocol</rt></ruby>SOAP是一个冗长而复杂的协议以致于你没法在不事先理解一堆互相关联的可扩展标记语言XML规范的基础上使用它。早期的网络服务提供基于 SOAP 的 API。在 21 世纪头十年中期,随着越来越多的 API 开始提供,被 SOAP 的复杂性激怒的软件开发者随之集体迁移。
SOAP 遭到了这群人的蔑视Rails 之父 <ruby>戴维·海涅迈尔·汉森<rt>David Heinemeier Hansson</rt></ruby>LCTT 译注:译自其所著的《重来》的中文版的作者译名)曾经评论:“我们感觉 SOAP 过于复杂了,它已经被企业人员接管。而当这一切发生的时候,通常没有什么好结果。”[^7] 始于这一标志性的评论Ruby-on-Rails 于 2007 年放弃了对 SOAP 的支持。“企业人员”总是希望所有内容都被正式指定,反对者认为这是浪费时间。
如果反对者不再继续使用 SOAP他们仍然需要一些标准化的方式来进行工作。由于所有人都在使用 HTTP而且代理与缓存的所有支持每个人都至少会继续使用 HTTP 作为传输层,因此最简单的解决方案就是依赖 HTTP 的现有语义。这正是他们所做的工作。他们曾经称之为:<ruby>去它的,重载 HTTP<rt>Fuck It, Overload HTTP</rt></ruby>FIOH。这会是一个准确的名称任何曾经试图决定业务逻辑错误需要返回什么 HTTP 状态码的人都能证明这一点。但是在所有的 SOAP 正式规范工作的映衬下,这显得鲁莽而乏味。
幸运的是,出现了这篇由 HTTP/1.1 规范的共同作者创作的博士论文。这篇博士论文与扩展 HTTP 有某种模糊的联系,并给予了 FIOH 一个具有学术体面的外表。因此 REST 非常适合用来掩饰其实仅仅是 FIOH 的东西。
我并不是说事情就是这样发生的,也不是说在不敬业的创业者中确实存在着盗用 REST 的阴谋,但是这个故事有助于我理解,在菲尔丁的博士论文根本就不是讨论网络服务 API 的情况下REST 是如何成为用于网络服务 API 的架构模型的。采用 REST 的约束存在一些效果,尤其是对于那些面向公众的需要跨越组织边界的 API 来说。这些 API 通常会从 REST 的“统一接口”中受益。这应该是 REST 起初在构建网络 API 时被提及的核心原因。但是,想象一下一种叫做 “FIOH” 的独立方法,它借用 “REST” 的名字只是为了营销,这有助于我解释我们今天所知道的 <ruby>REST 式<rt>RESTful</rt></ruby> API 与菲尔丁最初描述的 REST 的架构风格之间的诸多差异。
举例而言REST 纯粹主义者经常抱怨,那些所谓 RESTful API 实际并不是 REST API因为它们根本就没有使用 <ruby>超文本作为应用程序状态引擎<rt>Hypermedia as The Engine of Application State</rt></ruby>HATEOAS。菲尔丁本人也做出过 [这样的批评][11]。根据菲尔丁的观点,一个真正的 REST API 应当允许你通过跟随链接实现从一个基础端点访问所有的端点。如果你认为这些人的确在试图构建 RESTful API那么存在一个明显的疏漏 —— 使用超文本作为应用程序状态引擎HATEOAS的确是菲尔丁最初提出的 REST 概念的基础尤其是考虑到“描述性状态迁移REST”中的“状态迁移ST”意指使用资源之间的超链接进行状态机的导航而不是像很多人所相信的那样通过线路传输资源状态[^8]。但是你试想一下,如果每个人都只是在构建 FIOH 的 API并明里暗里的将之作为 REST API 宣传,或者更诚实一点说是作为 “RESTful” API 宣传那么自然使用超文本作为应用程序状态引擎HATEOAS也就不重要了。
类似的,你可能会感到惊讶:尽管软件开发者喜欢不断地争论使用 `PUT` 方法还是使用 `PATCH` 方法来更新资源更加 RESTful菲尔丁的博士论文却没有讨论哪个 HTTP 的操作方法应该映射到增删改查CURD操作。在 HTTP 操作与 CURD 操作之间建立一个标准的映射表是有用的,但是这一映射表是 FIOH 的一部分而不是 REST 的一部分。
这就是为什么,与其说没有人理解 REST不如说我们应该认为 “REST” 这一术语是被误用了。REST API 这一现代概念与菲尔丁的 REST 架构之间存在历史联系,但事实上它们是两个不同的概念。历史联系适合作为确定何时构建 RESTful API 的指引而留在心底。你的 API 需要像 HTTP 那样跨越组织和政府边界吗?如果是的话,那么构建具有统一的可预测的接口的 RESTful API 可能是正确的方式。如果不是的话,你最好记住,菲尔丁更倾向于形式服从功能。或许类似 GraphQL 的方案或者仅仅 JSON-RPC 更适合你试图完成的工作。
[^1]: Roy Fielding. “Architectural Styles and the Design of Network-based Software Architectures,” 128. 2000. University of California, Irvine, PhD Dissertation, accessed June 28, 2020, <https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation_2up.pdf>. 
[^2]: Fielding, 130. 
[^3]: Fielding distinguishes between software architectures and software architecture “styles.” REST is an architectural style that has an instantiation in the architecture of HTTP. 
[^4]: Fielding, 2. 
[^5]: Fielding, 15. 
[^6]: Fielding, 82. 
[^7]: Paul Krill. “Ruby on Rails 2.0 released for Web Apps,” InfoWorld. Dec 7, 2007, accessed June 28, 2020, <https://www.infoworld.com/article/2648925/ruby-on-rails-2-0-released-for-web-apps.html> 
[^8]: Fielding, 109. 
--------------------------------------------------------------------------------
via: https://twobithistory.org/2020/06/28/rest.html
作者:[Two-Bit History][a]
选题:[lujun9972][b]
译者:[CanYellow](https://github.com/CanYellow)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://twobithistory.org
[b]: https://github.com/lujun9972
[1]: https://news.ycombinator.com/item?id=7201871
[2]: https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation_2up.pdf
[9]: https://www.youtube.com/watch?v=vNoPJqm3DAY
[11]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
[13]: https://twitter.com/TwoBitHistory
[14]: https://twobithistory.org/feed.xml
[15]: https://twitter.com/TwoBitHistory/status/1247187881946275841?ref_src=twsrc%5Etfw
[0]: https://img.linux.net.cn/data/attachment/album/202303/20/154318tpynlzzdi1yhug5h.jpg

View File

@ -0,0 +1,90 @@
[#]: collector: (lujun9972)
[#]: translator: (cool-summer-021)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-15603-1.html)
[#]: subject: (Open Source Security Foundation \(OpenSSF\): Reflection and Future)
[#]: via: (https://www.linux.com/news/open-source-security-foundation-openssf-reflection-and-future/)
[#]: author: (The Linux Foundation https://www.linuxfoundation.org/en/blog/openssf-reflection-and-future/)
开源安全基金会OpenSSF回顾和展望
======
![][0]
[开源安全基金会][1]OpenSSF正式 [成立于 2020 年 8 月 3 日][2]。本文将讨论 OpenSSF 创立的初衷,它成立之初六个月内的成就,以及它未来的愿景。
LCTT 校注:原文发表于 2 年前, 但时至今日仍然有一些值得了解的信息。)
全世界都在推行开源软件OSS理念所以开源软件的安全也至关重要。为了提升开源软件的安全性业界已经做了大量工作并取得了一些成果。这些成果包括Linux 基金会的 <ruby>核心基础设施计划<rt>Core Infrastructure Initiative</rt></ruby>CII、GitHub 安全实验室的 <ruby>开源安全联盟<rt>Open Source Security Coalition</rt></ruby>OSSC和由谷歌以及其他公司创立的 <ruby>联合开源软件计划<rt>Joint Open Source Software Initiative</rt></ruby>JOSSI
显然,如果这些成果合为一体,软件行业将发展得更加顺利。这三项成果在 2020 年合并为“旨在促进开源软件安全性的、由各行业巨头主导的跨行业联盟”。
OpenSSF 的确受益于这种“跨行业联盟”;它有几十个成员,(按字母顺序)包括 Canonical、 GitHub、谷歌、IBM、英特尔、微软和红帽。联盟的理事会成员还包括安全社区个人代表这些个人代表是那些不能以企业名义作为联盟成员的个人。该联盟也创造了一些便于人们合作的组织结构建立一些活跃的工作组这种工作组确定并公布它存在的价值其中的成员应当就该组织的技术愿景形成一致意见。
但是这并不重要,除非它们有实际成果。当时虽然处于早期,它们也确实取得了一些成果。它们发布了:
* [安全软件开发基础课程][3]:在 edX 平台上有 3 门免费课程,旨在教授软件开发人员软件安全方面的知识。这些课程注重实际操作,任何开发人员都可以较轻松地学习,而不是那些需要耗费大量资源的理论或案例。开发人员也可以付费参加测试,从而获得认证,表明自己掌握了这些课程地内容。
* [安全评分卡][4]:为开源项目自动生成“安全分数”,帮助用户进行信任、风险和安全方面的决策。
* [关键性分数][5]:基于一些参数,为开源项目自动生成关键性分数。临界分数可以让人们对世界上最重要的开源项目有更好的理解。
* [安全度量仪表盘][6]这是较早时候发布的成果它结合安全评分卡、CII 最佳实践和其他数据来源,提供与 OSS 项目有关的安全和支持信息的仪表盘。
* [OpenSSF CVE 基准测试][7]:基准测试由超过 200 个历史上的 JavaScript/TypeScript 漏洞CVE的脆弱代码和元数据组成。这将帮助安全团队评估市场上的各种安全工具使他们能够用真实的代码库而不是合成的测试代码确定误报和漏报率。
* [OWASP 安全知识框架][8]:与 OWASP 的合作成果,它是一个知识库,包含了带检查清单的项目和使用多种编程语言的最佳代码样例。它还提供针对开发者如何使用特定的语言编写安全代码的培训材料,以及用于实际操作的安全实验室。
* 2020 年自由/开源软件贡献者调查报告OpenSSF 和 LISH 发布了一份报告,其中详细说明了对开源软件贡献者的调查结果,并以此为依据,研究和确定提高 OSS 安全性和可持续性的方法。一共调查了 1200 名受访者。
现有的 [CII 最佳实践徽章][10] 项目已经与 OpenSSF 合并,将继续升级。现在项目有很多中文译者,翻译为斯瓦希里语的工作也在进行中,项目也进行了很多小改进,详细阐明获得徽章的要求。
2020 年 11 月举行的 OpenSSF 大会讨论了 OpenSSF 正在进行中的工作。最近OpenSSF 有这些工作组:
* 漏洞披露
* 安全工具
* 安全最佳实践
* 对开源项目安全漏洞的识别(重点关注指标仪表盘)
* 对关键项目的保障
* 数字身份认证
除了持续更新已发布的项目,未来可能的工作还包括:
* 为减少重复工作,在多种技术指标中确定哪些是重复和关联的安全需求。这就是作为领导者与 OWASP 协作开发,也称为 <ruby>[通用需求枚举][12]<rt>Common Requirements Enumeration</rt></ruby>CRE。CRE 旨在使用一种公共主题标识符,将标准和指南的各个部分联系起来,这种公共主题标识符的作用是令标准和方案制定者高效工作,令标准使用者能搜索到需要的信息,从而使双方对网络安全有相同的理解。
* 建一个网站,提供对安全度量仪表盘的免安装访问。再次强调,这将会提供各种来源(包括安全计分卡和 CII 最佳实践)的数据的简单展示。
* 开发对关键 OSS 项目的识别功能。哈佛大学和 LF 已经做过一些识别关键 OSS 项目的工作。未来一年内,他们会改进方法,添加新的数据来源,从而更好地进行鉴别工作。
* 资助一些关键的 OSS 项目,提高它们的安全性。预期将关注那些财力不足的项目,帮助这些项目提升整体性能。
* 识别和实现已改进和简化的技术,用于数字签名的提交和对身份的校验。
跟所有的 Linux 基金会项目一样OpenSSF 的工作是由其成员决定的。如果你对大家所依赖的 OSS 安全有兴趣,你可以访问 OpenSSF 网站并以某种方式加入它们。参与的最好方式是出席工作组会议——会议每隔一周就举行,而且非常随意。通过合作,我们可以有所作为。欲了解更多信息,可以访问:
> **[https://openssf.org][1]**
作者:[David A. Wheeler][13] Linux 基金会开源供应链安全总监
[本文][14] 首次发表于 [Linux 基金会网站][15]。
--------------------------------------------------------------------------------
via: https://www.linux.com/news/open-source-security-foundation-openssf-reflection-and-future/
作者:[The Linux Foundation][a]
选题:[lujun9972][b]
译者:[cool-summer-021](https://github.com/cool-summer-021)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxfoundation.org/en/blog/openssf-reflection-and-future/
[b]: https://github.com/lujun9972
[1]: https://openssf.org/
[2]: https://www.linuxfoundation.org/en/press-release/technology-and-enterprise-leaders-combine-efforts-to-improve-open-source-security/
[3]: https://openssf.org/blog/2020/10/29/announcing-secure-software-development-edx-course-sign-up-today/
[4]: https://openssf.org/blog/2020/11/06/security-scorecards-for-open-source-projects/
[5]: https://github.com/ossf/criticality_score
[6]: https://github.com/ossf/Project-Security-Metrics
[7]: https://openssf.org/blog/2020/12/09/introducing-the-openssf-cve-benchmark/
[8]: https://owasp.org/www-project-security-knowledge-framework/
[9]: https://www.linuxfoundation.org/en/press-release/new-open-source-contributor-report-from-linux-foundation-and-harvard-identifies-motivations-and-opportunities-for-improving-software-security/
[10]: https://bestpractices.coreinfrastructure.org/
[11]: https://openssf.org/blog/2020/11/23/openssf-town-hall-recording-now-available/
[12]: https://owasp.org/www-project-integration-standards/
[13]: mailto:dwheeler@linuxfoundation.org
[14]: https://www.linuxfoundation.org/en/blog/openssf-reflection-and-future/
[15]: https://www.linuxfoundation.org/
[0]: https://img.linux.net.cn/data/attachment/album/202303/07/083725e6zk5pc2atq86qt9.jpg

View File

@ -0,0 +1,73 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-15674-1.html)
[#]: subject: (Why programmers love Linux packaging)
[#]: via: (https://opensource.com/article/21/2/linux-packaging)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
为什么程序员喜欢为 Linux 打包
======
> 程序员可以通过 Flatpak 轻松、稳定地发布他们的软件,让他们专注于他们的激情工作:编程。
![][0]
如今,人们比以往任何时候都喜爱 Linux。在这个系列中我将分享使用 Linux 的 21 个不同理由。今天,我将谈一谈是什么让 Linux 的打包成为程序员的理想选择。
程序员喜欢编程。这可能看起来是一个显而易见的说法,但重要的是要明白,开发软件所涉及的不仅仅是编写代码。它包括编译、文档、源代码管理、安装脚本、配置默认值、支持文件、交付格式等等。从一个空白的屏幕到一个可交付的软件安装程序,需要的不仅仅是编程,但大多数程序员宁愿编程也不愿打包。
### 什么是打包?
当食物被送到商店购买时,它是被包装好的。当直接从农民或从环保的散装或桶装商店购买时,包装是你所带的任何容器。当从杂货店购买时,包装可能是一个纸板箱、塑料袋、一个铁罐等等。
当软件被提供给广大计算机用户时,它也必须被打包起来。像食品一样,软件也有几种打包方式。开源软件可以不进行打包,因为用户在获得原始代码后,可以自己编译和打包它。然而,打包也有好处,所以应用程序通常以某种特定于用户平台的格式交付。而这正是问题的开始,因为软件包的格式并不只有一种。
对于用户来说,软件包使安装软件变得容易,因为所有的工作都由系统的安装程序完成。软件被从软件包中提取出来,并分发到操作系统中的适当位置。几乎没有任何出错的机会。
然而,对于软件开发者来说,打包意味着你必须学会如何创建一个包 —— 而且不仅仅是一个包,而是为你希望你的软件可以安装到的每一个操作系统创建一个独特的包。更加复杂的是,每个操作系统都有多种打包格式和选项,有时甚至是不同的编程语言。
### 为 Linux 打包
传统上Linux 的打包方式似乎是非常多的。从 Fedora 衍生出来的 Linux 发行版,如 Red Hat 和 CentOS默认使用 .rpm 包。Debian 和 Ubuntu以及类似的默认使用 .deb 包。其他发行版可能使用其中之一,或者两者都不使用,选择自定义的格式。当被问及时,许多 Linux 用户说,理想情况下,程序员根本不会为 Linux 打包他们的软件,而是依靠每个发行版的软件包维护者来创建软件包。所有安装在 Linux 系统上的软件都应该来自该发行版的官方软件库。然而,目前还不清楚如何让你的软件可靠地被一个发行版打包和包含,更不用说所有的发行版了。
### Linux 的 Flatpak
Flatpak 打包系统是为了统一和去中心化 Linux 作为开发者的交付目标而推出的。通过 Flatpak无论是开发者还是其他人Linux 社区的成员、不同的开发者、Flatpak 团队成员或其他任何人)都可以自由地打包软件。然后他们可以将软件包提交给 Flathub或者选择自我托管软件包并将其提供给几乎任何 Linux 发行版。Flatpak 系统适用于所有 Linux 发行版,所以针对一个发行版就等于针对所有发行版。
### Flatpak 技术如何工作
Flatpak 具有普遍吸引力的秘密是一个标准基础。Flatpak 系统允许开发者引用一套通用的软件开发者工具包SDK模块。这些模块由 Flatpak 系统的维护者进行打包和管理。当你安装 Flatpak 时SDK 会根据需要被拉入,以确保与你的系统兼容。任何特定的 SDK 只需要一次,因为它所包含的库可以在任何 Flatpak 中共享。
如果开发者需要一个尚未包含在现有 SDK 中的库,开发者可以在 Flatpak 中添加该库。
结果不言自明。用户可以从一个叫做 [Flathub][2] 的中央仓库在任何 Linux 发行版上安装数百个软件包。
### 开发者如何使用 Flatpak
Flatpak 被设计成可重复的,所以构建过程很容易被集成到 CI/CD 工作流程中。Flatpak 是在一个 [YAML][3] 或 JSON 清单文件中定义的。你可以按照我的 [介绍性文章][4] 创建你的第一个 Flatpak你也可以在 [docs.flatpak.org][5] 阅读完整的文档。
### Linux 让它变得简单
在 Linux 上创建软件很容易,为 Linux 打包也很简单而且可以自动化。如果你是一个程序员Linux 使你很容易忘记打包这件事,因为它只需要针对一个系统,并可以整合到你的构建过程中。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/2/linux-packaging
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brown-package-red-bow.jpg?itok=oxZYQzH- (Package wrapped with brown paper and red bow)
[2]: https://flatpak.org/setup/
[3]: https://www.redhat.com/sysadmin/yaml-beginners
[4]: https://opensource.com/article/19/10/how-build-flatpak-packaging
[5]: https://docs.flatpak.org/en/latest/index.html
[0]: https://img.linux.net.cn/data/attachment/album/202303/29/231331qb9ye8gggeekvce1.jpg

View File

@ -0,0 +1,130 @@
[#]: subject: "Learn everything about computers with this Raspberry Pi kit"
[#]: via: "https://opensource.com/article/21/9/raspberry-pi-crowpi2"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: "XiaotingHuang22"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15656-1.html"
用 CrowPi 树莓派套件了解关于计算机的一切
======
> CrowPi 是一个超棒的树莓派项目系统,安装在一个笔记本电脑般的外壳里。
![][0]
我喜欢历史,也喜欢计算机,因此相比于计算机如何变成个人配件,我更喜欢听它在成为日常家用电器前的故事。[我经常听到的一个故事][2] 是很久以前(反正在计算机时代算久远了)的计算机是多么的简单。事实上,它们简单到对于一个好奇的用户来说,弄清楚如何编程并不是十分困难。再看看现代计算机,它具有面向对象的编程语言、复杂的 GUI 框架、网络 API、容器等但愈发令人担忧的是计算工具正变得越来越难懂对于那些没有接受过专门培训的人来说基本上无法使用。
从树莓派在 2012 年发布之日起,它就一直被定位为一个教育平台。一些第三方供应商通过附加组件和培训套件支持树莓派,以帮助所有年龄段的学习者探索编程、物理计算和开源。然而,直到最近,很大程度上还是要由用户来弄清楚市场上的所有部件如何组合在一起,直到我最近买了 CrowPi。
![CrowPi 不是一个笔记本电脑][3]
### CrowPi2 介绍
乌鸦是非常聪明的鸟。它们能识别并记住面孔模仿听到的声音解决复杂的谜题甚至使用工具来完成任务。CrowPi 使用乌鸦作为其徽标和名字是恰当的,因为这个设备充满了探索、实验、教育的机会,最重要的是,充满了乐趣。
其设计很巧妙:它看起来像笔记本电脑,但远不止于此。当你从机壳中取出蓝牙键盘时,它会显示一个隐藏的电子设备工坊,配有 LCD 屏幕、16 个按钮、刻度盘、RFID 传感器、接近传感器、线路板、扬声器、GPIO 连接、LED 阵列等等。_而且这一切都是可编程的。_
顾名思义,该装置本身完全由树莓派提供支持,它牢固地固定在机壳底部。
![CrowPi 的树莓派板][5]
默认情况下,你应该用电源适配器为设备充电,包装附带一个壁式插头,你可以将其插入机壳,而不是直接为树莓派供电。你还可以使用插入外部微型 USB 端口的电池电源。机壳内甚至还有一个抽屉,方便你存放电池。这样做的时候,有一根 USB 线从电池抽屉中弹出,并插入机壳电源端口,因此你不会产生这是一台“普通”笔记本电脑的错觉。然而,这样一台设备能够有如此美观的设计已经很理想了!
### 首次启动系统
CrowPi2 提供一张安装了 Raspbian 系统,贴有 “System” 标签的 microSD 卡,不过它同时还提供了装载 [RetroPie][6] 的第二张 microSD 卡。作为一个负责任的成年人(咳咳),我自然是先启动了 RetroPie。
RetroPie 总是很有趣CrowPi2 附带两个超任风格的游戏控制器,确保你能获得最佳的复古游戏体验。
令人赞叹不已的是,启动实际的 Raspbian 系统的过程同样有趣甚至可以说更有趣。它的登录管理器是一个自定义项目中心有一些快速链接如编程示例项目、Python 和 Arduino IDE、Scratch、Python 示例游戏、Minecraft 等。你也可以选择退出项目中心,只使用桌面。
![CrowPi 中心][7]
对于习惯使用树莓派或 Linux 的人来说CrowPi 桌面很熟悉,不过它也足够简单,所以很容易上手。左上角有应用程序菜单,桌面上有快捷图标,右上角有网络选择和音量控制的系统托盘等等。
![CrowPi 桌面][8]
CrowPi 上有很多东西可供选择所以你可能很难决定从哪里开始。对我来说主要分为四大类编程、物理电子学、Linux 和游戏。
盒子里有一本使用说明,所以你会知道你需要怎样进行连接(例如,键盘是电池供电的,所以它有时确实需要充电,它和鼠标总是需要一个 USB 适配器)。虽然说明书很快就能读完,但这一例子也充分体现了 CrowPi 团队是如何认真对待说明书的。
![CrowPi 文档][9]
### 编程
如果你想学习如何编码,在 CrowPi 上有很多成功的途径。你可以从中选择你觉得最满意的路径。
#### 1、Scratch
[Scratch][10] 是一个简单的可视化编码应用程序,可让你像拼 [乐高积木][11] 一样将代码块组合在一起,制作出游戏和互动故事。这是开启编程之旅最简单的方法,我曾见过年仅 8 岁的孩子会花数小时来研究自己设计的游戏的最佳算法。当然,它不仅适合孩子们!成年人也可以从中获得很多乐趣。不知道从哪里开始?包装盒中有一本 99 页的小册子(打印在纸张上),其中包含 Scratch 课程和项目供你尝试。
#### 2、Java 和 Minecraft
Minecraft 不是开源的(虽然有 [几个开源项目][12] 复刻了它但它有足够的可用资源因此也经常被用来教授编程。Minecraft 是用 Java 编写的CrowPi 同时装载有 [Minecraft Pi Edition][13] 和 [BlueJ Java IDE][14] ,如此可使学习 Java 变得比以往更容易、更有趣。
#### 3、Python 和 PyGame
CrowPi 上有几个非常有趣的游戏,它们是用 Python 和 [PyGame 游戏引擎][15] 编写的。你可以玩这些游戏然后查看其源代码以了解游戏的运行方式。CrowPi 中包含 Geany、Thonny 和 [Mu][16] 编辑器,因此你可以使用 Python 立即开始编程。与 Scratch 一样,包装盒中有一本包含有课程的小册子,因此你可以学习 Python 基础知识。
### 电子器件
隐藏在键盘下的物理电子工坊本质上是一系列 Pi Hat附着在上的硬件。为了让你可以认识所有的组件CrowPi 绘制了一张中英双语的折页图进行详细的说明。除此之外还有很多示例项目可以帮助你入门。 以下是一张小清单:
* **你好**:当你与 CrowPi 说话时LCD 屏幕上打印输出“你好”。
* **入侵警报**:使用接近传感器发出警报。
* **远程控制器**:让你能够使用远程控制(是的,这个也包含在盒子里)来触发 CrowPi 上的事件。
* **RGB 俄罗斯方块**:让你可以在 LED 显示屏上玩俄罗斯方块游戏。
* **语音识别**:演示自然语言处理。
* **超声波音乐**:利用距离传感器和扬声器创建简易版的 <ruby>特雷门琴<rt>Theramin</rt></ruby>LCTT 译注:世上唯一不需要身体接触的电子乐器)。
这些项目仅仅是入门级别而已因为你还可以在现有的基础上搭建更多东西。当然还有更多内容值得探索。包装盒里还有网络跳线、电阻、LED 和各种组件,这样你闲暇时也可以了解树莓派的 GPIO (通用输入输出端口)功能的所有信息。
不过我也发现了一个问题:示例项目的位置有点难找。找到演示项目很容易(它们就在 CrowPi 中心上),但源代码的位置并不是很容易被找到。我后来发现大多数示例项目都在 `/usr/share/code` 中,你可以通过文件管理器或终端进行访问。
![CrowPi 外围设备][17]
### Linux
树莓派上运行的是 Linux 系统。如果你一直想更深入了解 Linux那么 CrowPi 同样会是一个很好的平台。你可以探索 Linux 桌面、终端以及几乎所有 Linux 或开源应用程序。如果你多年来一直在阅读有关开源的文章,并准备深入研究开源操作系统,那么 CrowPi 会是你想要的平台(当然还有很多其他平台也可以)。
### 游戏
包装盒中包含的 **RetroPie** SD 卡意味着你可以重新启动切换为复古游戏机,并任意玩各种老式街机游戏。它跟 Steam Deck 并不完全相同,但也是一个有趣且令人振奋的小游戏平台。因为它配备的不是一个而是两个游戏控制器,所以它非常适合多人合作的沙发游戏。最重要的是,你不仅可以在 CrowPi 上玩游戏,还可以制作自己的游戏。
### 配备螺丝刀
自我坐下开始使用 CrowPi2 以来已经大约两周,但我还没有通关所有项目。有很多个晚上,我不得不强迫自己停下摆弄它,因为即使我厌倦了一个项目,我也会不可避免地发现还有其他东西可以探索。总而言之,我在盒子里找到了一个特别的组件,这个组件让我马上知道 CrowPi 和我就是天造地设它是一把不起眼的小螺丝刀。盒子上没有撕开就不保修的标签。CrowPi 希望你去修补、拆解、探索和学习。它不是笔记本电脑,甚至也不仅仅是个树莓派;而是一个便携的、低功耗的、多样化的、开源的学习者工具包。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/raspberry-pi-crowpi2
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[XiaotingHuang22](https://github.com/XiaotingHuang22)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?)
[2]: https://opensource.com/article/21/8/my-first-programming-language
[3]: https://opensource.com/sites/default/files/crowpi-not-laptop.jpeg (CrowPi more than a laptop)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/crowpi-pi.jpeg (crowpi pi board)
[6]: https://opensource.com/article/19/1/retropie
[7]: https://opensource.com/sites/default/files/crowpi-hub.png (CrowPi hub)
[8]: https://opensource.com/sites/default/files/crowpi-desktop.png (CrowPi desktop)
[9]: https://opensource.com/sites/default/files/crowpi-docs.jpeg (CrowPi docs)
[10]: https://opensource.com/article/20/9/scratch
[11]: https://opensource.com/article/20/6/open-source-virtual-lego
[12]: https://opensource.com/alternatives/minecraft
[13]: https://www.minecraft.net/en-us/edition/pi
[14]: https://opensource.com/article/20/7/ide-java#bluej
[15]: https://opensource.com/downloads/python-gaming-ebook
[16]: https://opensource.com/article/18/8/getting-started-mu-python-editor-beginners
[17]: https://opensource.com/sites/default/files/crowpi-peripherals.jpeg (CrowPi peripherals)
[0]: https://img.linux.net.cn/data/attachment/album/202303/24/170210th71d0o707worogv.jpg

View File

@ -0,0 +1,112 @@
[#]: subject: "9 ways to use open source every day"
[#]: via: "https://opensource.com/article/21/10/open-source-tools"
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
[#]: collector: "lujun9972"
[#]: translator: "XiaotingHuang22"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15604-1.html"
每天使用开源的 9 种方法
======
> 你可能会惊奇地发现,那些你每天使用的工具竟是开源的。
![][0]
最近,我受邀介绍网络上可用的免费和开放资源。这次演讲是当地为保持我们社区的正常运转而做出的部分尝试 —— 由我家附近的 <ruby>圣文德大学<rt>St. Bonaventure University</rt></ruby> [Foster Center][2] 赞助。 我分享的一些资源不是开源的而是免费的,但许多工具是开源的。
看到有不少人知道我所提到的工具真的很有趣。很多人并不知道他们每天使用的工具都是开源的,并且他们还可以与他人分享。
### 开源浏览器
使用网络需要一个好的浏览器,而 [Firefox 是开源的][3]这一点很多在场的人并不清楚。除了是开源Firefox 还具有强烈的隐私意识,这是许多用户越来越关注的问题。不过,有趣的是,即使是微软的新浏览器也是基于开源 Chromium 项目的。
### 开源网络隐私
通常,保护你的隐私和改善你的网络体验的另一种方法是使用 uBlock Origin 来阻止广告。根据他们的网站:
> uBlock Origin 是一个免费、开源、跨平台的内容过滤浏览器扩展——主要旨在以一种高效、用户友好的方法消除隐私侵犯。
其代码采用 [GPL v. 3.0][4] 许可证。
<ruby>电子前沿基金会<rt>Electronic Frontier Foundation</rt></ruby>EFF还维护 [Privacy Badger][5]———— 这是一个根据 GPL v.3.0 许可的网络浏览器扩展程序。根据他们的 GitHub 存储库,它是:
> 一个可以自动学习阻止隐形的跟踪器的浏览器扩展程序。Privacy Badger 没有一个要阻止的列表,而是根据它们的行为自动发现跟踪器。
除了隐私之外,我的演讲还分享了安全密码的重要性。我的听众了解到了 [Bitwarden][6]。许多人不知道如何生成安全密码、区分不同网站的密码以及如何安全地存储它们。我演示了该软件如何创建密码并使用 Bitwarden 将这些密码存储在云中。我解释了用户如何通过浏览器插件、台式机和笔记本电脑应用程序以及在安卓或 iOS 移动设备上访问这些凭证。
### 开源通讯工具
本次演讲中,我谈到了通讯工具在我们生活中的无处不在,但同时它本身固有的不安全性。观众不知道 [Signal][7]。我已经使用 Signal 几年了,并经常鼓励其他人将其视为一个安全的消息传递平台。在 Linux、macOS、Windows、[安卓][9] 和 [iOS][10] 上 [安装 Signal][8] 很容易,它提供了出色的 [文档][11] 支持对不同的操作系统都有着详细的安装说明。Signal 使用你现有的手机号码,只要它可以发送和接收短信和打电话。当你第一次在手机上设置 Signal 时,它会在你的通讯录上搜索同样使用 Signal 的联系人。
### 开源办公工具
如果不提及我最喜欢的内容创建工具 [LibreOffice][12],那么关于开源工具的介绍是不完整的。尽管它很受欢迎,但还是有许多人并不知道它的存在以及使用它所带来的自由。我每天都用它来写文章。我使用它来做表格而不是 Excel有时我用它来做演示文稿。你可以在 Linux、macOS 和 Windows 上下载并安装它。LibreOffice 的优点之一是你真正拥有自己的文档,不需要昂贵的程序来访问它们。
### 开源博客软件
[WordPress][13] 是我最喜欢的博客引擎,你可以通过多种方式使用它,无论是分享你对世界大事的看法、为你的 [学生][14] 提供低成本写作平台,还是在网上为你的 [业务][15] 做宣传。
### 开源媒体库
在创建内容时,你需要可以轻松合法共享的图片来说明你的作品。[OpenClipart][16] 是我的首选。这里有数以千计的各种流行格式的图片,可以放在你的 LibreOffice 文档和博客文章中。此外,你可以通过 <ruby>[知识共享][17]<rt>Creative Commons</rt></ruby> 找到你可以分享的图片,并注明适当的出处。知识共享提供的许可,使共享变得更容易。它是版权的延伸,让分享图片变得更容易。但请务必熟悉许可证之间的细微差别。
### 开源视频会议
疫情改变了会议和聚会的模式。正如 Chris Hermansen [此处][18] 所报告的那样Jitsi、Big Blue Button 和其他一些软件已经彻底改变了我们互动和学习的方式。
### 开源教育资源
开放教育资源解放了学习。通过 [OER Commons][19]你可以找到满足你需求的内容从学前班到研究生和专业学位它是公开许可的因此你可以使用它并与他人分享。麻省理工学院MIT开放课件提供了麻省理工学院几乎所有的本科生和研究生项目内容均根据知识共享 [非商业性共享方式][20] 许可提供。[OpenStax][21] 是莱斯大学的一项开放教科书计划,提供经过同行评审的教科书,这些教科书已公开许可并免费提供。
### 开源播客工具
播客已成为了解最新 [开源新闻][22] 的好方法。你有没有想过做自己的播客?我熟悉一些很棒的开源工具能够帮你实现这一目标。[Audacity][23] 是我最喜欢的录音应用程序。我用它来翻录我的课堂教学、记录访谈和试验音效。它是一个 16 轨音频编辑器,你可以通过多种方式使用它。如果你有话要说或有技能要传授,你应该使用 [Open Broadcaster Software][24]OBS
### Linux
最后,向你的朋友介绍 Linux他们中的许多人仍然不了解 Linux让他们体验所有现成的免费软件。
除了在 [YouTube][25] 上录制和分享的演讲外,我还编制了一份资源链接列表,并在 [GitHub][26] 上分享。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/10/open-source-tools
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[XiaotingHuang22](https://github.com/XiaotingHuang22)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl (Tools illustration)
[2]: https://www.sbu.edu/academics/schools-at-sbu/school-of-business/foster-center-for-responsible-leadership/foster-center-events
[3]: https://opensource.com/article/21/9/switch-to-firefox
[4]: https://github.com/gorhill/uBlock
[5]: https://privacybadger.org/
[6]: https://github.com/bitwarden
[7]: https://opensource.com/article/19/10/secure-private-messaging
[8]: https://signal.org/download/
[9]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&referrer=utm_source%3DOWS%26utm_medium%3DWeb%26utm_campaign%3DNav
[10]: https://apps.apple.com/us/app/signal-private-messenger/id874139669
[11]: https://support.signal.org/
[12]: https://opensource.com/article/21/9/libreoffice-tips
[13]: https://opensource.com/article/18/10/setting-wordpress-raspberry-pi
[14]: https://opensource.com/article/20/4/wordpress-virtual-machine
[15]: https://opensource.com/article/21/3/wordpress-plugins-retail
[16]: https://openclipart.org/
[17]: https://search.creativecommons.org/
[18]: https://opensource.com/article/20/5/open-source-video-conferencing
[19]: https://www.oercommons.org/
[20]: https://ocw.mit.edu/help/faq-cite-ocw-content/
[21]: https://openstax.org/
[22]: https://opensource.com/article/19/10/linux-podcasts-Jupiter-Broadcasting
[23]: https://opensource.com/article/20/4/audacity
[24]: https://opensource.com/article/20/4/open-source-live-stream
[25]: https://youtu.be/aUgaYtN_sUU
[26]: https://github.com/donwatkins/Presentations/blob/master/fostercenter.md
[0]: https://img.linux.net.cn/data/attachment/album/202303/07/153419u0nfxeogevozebfv.jpg

View File

@ -0,0 +1,177 @@
[#]: subject: "OpenWrt, an open source alternative to firmware for home routers"
[#]: via: "https://opensource.com/article/22/7/openwrt-open-source-firmware"
[#]: author: "Stephan Avenwedde https://opensource.com/users/hansic99"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15671-1.html"
OpenWrt一个开源的家用路由器固件替代品
======
![][0]
> OpenWrt 是一个基于 Linux 的开源操作系统,主要针对嵌入式网络设备。
如果你在家里阅读这篇文章,你可能是用一个 LTE/5G/DSL/WIFI 路由器联网的。这种设备通常负责在你的本地设备智能手机、PC、电视等之间路由数据包并通过内置的调制解调器提供对 WWW 的访问。你家里的路由器很可能有一个基于网页的界面,用于配置该设备。这种界面往往过于简单,因为它们是为普通用户制作的。
如果你想要更多的配置选项,但又不想花钱买一个专业的设备,你应该看看其他的固件,如 [OpenWrt][2]。
### OpenWrt 的特点
OpenWrt 是一个基于 Linux 的、针对嵌入式网络设备的开源操作系统。它主要用于替代各种家用路由器上的原始固件。OpenWrt 具备一个好的路由器应该具备的所有有用功能,如 DNS 服务器([dnsmasq][3]WiFi 接入点AP和客户端功能用于调制解调器功能的 PPP 协议,而且,与标准固件不同,这一切都是可以完全配置的。
#### LuCI 网页界面
OpenWrt 可以通过命令行SSH或使用 GUI 配置界面([LuCI][4]进行远程配置。LuCI 是一个用 [Lua][5] 编写的轻量级、可扩展的网页 GUI它可以精确地配置你的设备。除了配置LuCI 还提供了很多额外的信息,如实时图表、系统日志和网络诊断。
![LuCI 网页界面][6]
LuCI 有一些可选的扩展,以增加更多的配置选择。
#### 可写文件系统
它的另一个亮点是可写文件系统。原有的固件通常是只读的,而 OpenWrt 配备了一个可写的文件系统,这要归功于一个巧妙的解决方案,它将 OverlayFS 与 SquashFS/JFFS2 文件系统相结合,允许安装软件包以增强功能。在 [OpenWrt 文档][8] 中可以找到更多关于文件系统架构的信息。
#### 扩展
OpenWrt 有一个相关的软件包管理器,[opkg][9],它允许安装额外的服务,比如 FTP 服务器、DLNA 媒体服务器、OpenVPN 服务器、用于实现文件共享的 Samba 服务器、控制电话的 Asterisk 等等。当然,有些扩展需要适当的底层硬件资源。
### 动机
你可能想知道为什么要冒着对你的设备造成不可修复的损害和失去保修的风险,而尝试更换路由器制造商的固件。如果你的设备以你想要的方式工作,那么你可能不应该。永远不要碰一个正在运行的系统!但是,如果你想增强功能,或者你的设备缺乏配置选项,那么你应该看看 OpenWrt 是否可以成为一种补救措施。
在我的例子中,我想要一个旅行用的路由器,当我在露营地的时候,我可以把它放在一个合适的位置,以便让其它设备与这个本地 WiFi 接入点AP保持良好连接。该路由器将作为一个普通的客户端连接到互联网并广播它的 WiFi 接入点让我的其它设备连接到它。这样我就可以配置我的所有设备与这个路由器的接入点连接,当我在其他地方时我只需要改变路由器的客户端连接。此外,在一些露营地,你只能得到一个单一设备的访问代码,我可以通过这种设置来加强。
作为我的旅行路由器,我选择 TP-Link TL-WR902AC 的原因如下:
* 很小
* 两根 WiFi 天线
* 5V 电源USB
* 低功耗
* 成本效益高(你以 30 美元左右的价格得到它)
为了了解它的尺寸,这里是它在树莓派 4 旁边的样子:
![TP-Link TL-WR902AC 在树莓派旁边][10]
尽管这个路由器带来了我所需要的所有硬件功能,但我很快发现,默认的固件并不能让我按照我想要的方式配置它。该路由器主要是作为一个 WiFi 接入点,它可以复制现有的 WiFi 网络或通过板载以太网接口将自己连接到网络。默认的固件对于这些使用情况是非常有限的。
LCTT 译注:此型号国内没有销售,它的特点之一是可以通过插入 3G/4G USB 网卡连接到互联网,但由于它不在国内销售,所以没有支持哪种国内 3G/4G USB 网卡的说明,我 [查下来](https://www.tp-link.com/lk/support/3g-comp-list/tl-wr902ac/?location=1963) 似乎华为的 E3372h-320 是可用的。有相关实践的同学可以分享一下经验。
国内销售的其它类似型号只能通过以太网口或 WiFi 连接到互联网,这种情况下,如果只能通过 3G/4G 连接互联网,那需要另外买一个随身 WiFi /移动路由器。)
幸运的是,该路由器能够运行 OpenWrt所以我决定用它来替换原来的固件。
### 安装
当你的 LTE/5G/DSL/WiFi 路由器符合 [最低要求][12] 时,很有可能在它上面运行 OpenWrt。下一步你要查看 [硬件表][13]检查你的设备是否被列为兼容以及你要选择哪个固件包。OpenWrt 的 [TP-Link TL-WR902AC][14] 的页面还包括安装说明,其中描述了如何刷入内部存储器。
刷入固件的过程在不同的设备之间可能会有所不同,所以我就不详细介绍了。简而言之,我必须通过将设备连接到一个具有特定 IP 地址的网络接口上的 TFTP 服务器,重命名 OpenWrt 固件文件,然后按复位按钮启动设备。
### 配置
一旦刷入成功你的设备现在应该用新的固件启动了。现在启动可能需要更长的时间因为与默认固件相比OpenWrt 具有更多的功能。
为了开始配置,需要在你的 PC 和路由器之间建立一个直接的以太网连接OpenWrt 在此充当了一个 DHCP 服务器,并将你的 PC 的以太网适配器配置为一个 DHCP 客户端。
在 Fedora Linux 上,要激活你的网络适配器的 DHCP 客户端模式,首先你必须通过运行找出连接的 UUID
```
$ nmcli connection show
NAME          UUID         TYPE      DEVICE
Wired Conn 1  7a96b...27a  ethernet  ens33
virbr0        360a0...673  bridge   virbr0
testwifi      2e865...ee8  wifi     --
virbr0        bd487...227  bridge   --
Wired Conn 2  16b23...7ba  ethernet --
```
选择你要修改的连接的 UUID然后运行
```
$ nmcli connection modify <UUID> ipv4.method auto
```
你可以在 [Fedora 联网维基][15] 中找到更多关于这些命令的信息。
在你连接到路由器后,打开一个网页浏览器并导航到 [http://openwrt/][16]。现在你应该看到 LuCI 的登录管理器:
![LuCI 登录][17]
使用 `root` 作为用户名,并将密码留空。
### 配置 WiFi 和路由
要配置你的 WiFi 天线,请点击 “<ruby>网络<rt>Network</rt></ruby>” 菜单并选择 “<ruby>无线<rt>Wireless</rt></ruby>”。
![LuCI 无线配置][19]
在我的设备上,上面的天线 `radio0` 工作在 2.4GHz 模式,并连接到名为 `MOBILE-INTERNET` 的本地接入点。下面的天线 `radio1` 工作在 5GHz有一个相关的接入点SSID 为 `OpenWrt_AV`。通过点击 “<ruby>编辑<rt>Edit</rt></ruby>” 按钮,你可以打开设备配置,以决定该设备属于 LAN 还是 WWAN 网络。在我的例子中,接入点 `OpenWrt_AV` 属于 LAN 网络,客户端连接 `MOBILE-INTERNET` 属于 WWAN 网络。
![LuCI 配置屏幕][21]
配置的网络在 “<ruby>接口<rt>Interfaces</rt></ruby>” 面板的 “<ruby>网络<rt>Network</rt></ruby>” 下列出。
![设备列表][23]
为了获得我想要的功能,网络流量必须在 LAN 和 WWAN 网络之间进行路由。路由可以在 “<ruby>网络<rt>Network</rt></ruby>” 面板的 “<ruby>防火墙<rt>Firewall</rt></ruby>” 部分进行配置。我没有在这里做任何改动,因为在默认情况下,网络之间的流量是被路由的,而传入的数据包(从 WWAN 到 LAN必须通过防火墙。
![防火墙设置][28]
因此,你需要知道的是一个接口是属于 LAN 还是 (W)WAN。这个概念使它相对容易配置特别是对初学者来说。你可以在 [OpenWrt 联网基础][25] 指南中找到更多信息。
### 专属门户
公共 WiFi 接入点通常受到 [专属门户][26] 的保护,你必须输入一个访问代码或类似的代码。通常情况下,当你第一次连接到接入点并试图打开一个任意的网页时,这种门户就会出现。这种机制是由接入点的 DNS 服务器实现的。
默认情况下OpenWrt 激活了一个安全功能,可以防止连接的客户端受到 [DNS 重新绑定攻击][27]。OpenWrt 的重新绑定保护也阻止了专属门户网站被转发到客户端,所以你必须禁用重新绑定保护,以便你可以到达专属门户网站。这个选项在 “<ruby>网络<rt>Network</rt></ruby>” 菜单的 “<ruby>DHCP 和 DNS<rt>DHCP and DNS</rt></ruby>” 面板中。
### 尝试 OpenWrt
由于升级到 OpenWrt我得到了一个基于商品硬件的灵活的旅行路由器。OpenWrt 使你的路由器具有完全的可配置性和可扩展性,而且由于其制作精良的网页 GUI它也适合初学者使用。甚至有一些 [精选路由器][30] 在出厂时已经安装了 OpenWrt。你还可以用很多 [可用的软件包][31] 来增强你的路由器的功能。例如,我正在使用 [vsftp][32] FTP 服务器,在连接的 U 盘上托管一些电影和电视剧。看看该 [项目主页][33],在那里你可以找到许多切换到 OpenWrt 的理由。
图片来自: Stephan Avenwedde[CC BY-SA 4.0][7]
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/7/openwrt-open-source-firmware
作者:[Stephan Avenwedde][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/hansic99
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/OSDC_Internet_Cables_520x292_0614_RD.png
[2]: https://openwrt.org
[3]: https://thekelleys.org.uk/dnsmasq/doc.html
[4]: https://openwrt.org/docs/guide-user/luci/start
[5]: https://opensource.com/article/20/2/lua-cheat-sheet
[6]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_overview_c_0.png
[7]: https://creativecommons.org/licenses/by-sa/4.0/legalcode
[8]: https://openwrt.org/docs/techref/flash.layout
[9]: https://openwrt.org/docs/guide-user/additional-software/opkg
[10]: https://opensource.com/sites/default/files/2022-07/OpenWrt_Comparison_RaspberryPi.jpg
[12]: https://openwrt.org/supported_devices
[13]: https://openwrt.org/toh/start
[14]: https://openwrt.org/toh/tp-link/tl-wr902ac_v3
[15]: https://fedoraproject.org/wiki/Networking/CLI
[16]: http://openwrt/
[17]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_login_manager.png
[19]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_wireless_section_c.webp
[21]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_wifi_device_configuration.webp
[23]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_network_devices_0.webp
[25]: https://openwrt.org/docs/guide-user/base-system/basic-networking
[26]: https://en.wikipedia.org/wiki/Captive_portal
[27]: https://en.wikipedia.org/wiki/DNS_rebinding
[28]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_firewall_settings.webp
[30]: https://opensource.com/article/22/1/turris-omnia-open-source-router
[31]: https://openwrt.org/packages/table/start
[32]: https://openwrt.org/docs/guide-user/services/nas/ftp.overview
[33]: https://openwrt.org/reasons_to_use_openwrt
[0]: https://img.linux.net.cn/data/attachment/album/202303/29/105431e78pqv0n8x6aqm0l.jpg

View File

@ -0,0 +1,197 @@
[#]: subject: "How to Install and Use htop in Linux"
[#]: via: "https://itsfoss.com/use-htop/"
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "perfiffer"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15625-1.html"
如何在 Linux 中安装和使用 htop
======
Windows 有其著名的任务管理器。Linux 有几个 GUI 和 [命令行的系统监视器][1]。每个 Linux 系统都都有几个这样的监视器。
在命令行中,`top` 命令可能是用于快速检查系统资源使用情况的最佳命令。
除了查看进程之外,[使用 top 命令][2] 可能会很麻烦。而这就是 `htop` 的优势所在。抛开双关语不谈,`htop` 是一个类似于 `top` 的实用程序,但具有更好的、用户友好的界面。
在本指南中,我将向你展示如何在 Linux 中安装和使用 `htop`
### 在 Linux 中安装 htop 实用程序
在大多数的 Linux 发行版中你不会找到预安装的 `htop`,但作为最流行的实用程序之一,你会在几乎每个 Linux 发行版的默认存储库中找到 `htop`
因此,如果你的机器是基于 Debian/Ubuntu 驱动的,则以下命令应该可以完成你的工作:
```
sudo apt install htop
```
类似的,如果你使用的是 Fedora则可以使用以下的命令
```
sudo dnf install htop
```
如果你想避免从源代码构建包,还有一个 Snap 包可用:
```
sudo snap install htop
```
如果你使用的是其它的发行版或者想从源代码构建,你可以随时参考 [htop 的 GitHub 页面][3]以获得详细说明。
完成安装后,你只需在终端中使用 `htop` 命令,它将反映系统中所有正在运行的进程:
```
htop
```
![安装和使用 htop][4]
`htop` 中,每个部分都使用颜色标识,所以让我们看看使用 `htop` 时每种颜色表示什么。
##### htop 中不同的颜色和统计信息表示什么
让我们从 CPU 使用率栏开始,因为它使用的颜色最缤纷多彩。
#### CPU 使用率栏
![htop 中的 cpu 进程][5]
- **绿色**:用户进程消耗的资源。
- **蓝色**:表示低优先级线程。
- **红色**:系统(内核)进程使用的 CPU 资源。
- **水蓝色**:表示虚拟化进程。
#### 内存使用率栏
![htop 中的内存栏][6]
- **绿色**:系统进程正在使用的内存。
- **蓝色**:缓冲页面使用的内存。
- **橙色**:分配给缓存页面的内存。
#### 统计数据
![htop 中的任务统计][7]
- **1.86** 是最后 1 分钟的平均负载。
- **1.75** 是最后 4 分钟的平均负载。
- **1.47** 是最后 15 分钟的平均负载。
- **Tasks: 166** 表示一共有 166 个正在运行的进程。
- **1249 thr** 表示这 166 个进程由 1249 个线程处理。
- **1 running** 表示在这 166 个进程中,只有一个进程处于运行中。
- **The load average** 表示一段时间内的平均系统负载。由于我的系统是 Hexa-Core所以 6.0 以下的是没问题的。这个数字可能会超过,比如 6.1,所以即将要运行的进程必须等待正在进行的任务完成。
- **Uptime** 表示你登录后运行的时长。
现在,让我们跳到实际的实现部分。
### 如何在 Linux 中使用 htop
由于 `htop` 主要用于检查系统资源,让我们看看如何根据资源消耗对进程进行排序。
#### 根据资源消耗对进程进行排序
根据 CPU 和内存使用情况对进程进行排序最简单的方法是使用鼠标指针。将光标悬停在 CPU 或内存部分上,然后单击其中任何一个。
在那里你会看到一个三角形的图标 `△`,你可以根据它从最高到最低的资源消耗对进程进行排序:
但是,如果你正在处理远程服务器,你可能无法使用鼠标,在这种情况下,你可以使用键盘快捷键。
`F6`,它将显示每个可用的选项来对正在进行的进程进行排序:
![使用键盘快捷键对 htop 中的进程进行排序][8]
你可以使用方向键选择一个首选的排序选项,然后按回车键,结果应该会如预期的那样反映出来。
#### 搜索特定进程
如果你想查找一个特定的进程及其资源消耗,你可以按 `F3`,它会给你一个搜索提示,如下所示:
![在 htop 中搜索进程][9]
例如,我搜索 `htop`,它用浅橙色高亮显示了进程。你可以按 `F3` 获得下一个结果。
#### 过滤正在运行的进程
虽然搜索可能会让你获得预期的结果,但我发现使用关键字的过滤过程更加有效,因为它提供了一个过程列表。
要过滤进程,你必须按 `F4` 并输入进程的名称。例如,我过滤了与 `gnome-boxes` 相关的进程:
![在 htop 中过滤进程][10]
#### 杀死进程
一旦找到最耗资源和不必要的进程,你只需按 `F9`,它就会向你显示终止信号:
![在 htop 中杀死进程][11]
我无法介绍所有的 15 个终止信号,我们有一个关于 [不同终止信息][12] 的单独指南,因此如果你想了解更多信息,可以参考该指南。
但我会建议你首先使用 `SIGTERM`,因为它是终止进程的最有效和友好的方式。
#### 自定义 htop
在这里,我的目标是添加日期和时间并将配色方案更改为单色。
首先,按 `F2`,它会出现设置提示,允许用户更改 `htop` 的外观:
![在 ubuntu 中自定义 htop][13]
首先,将鼠标悬停在各个 `Colors` 部分并按回车键,这将允许我们更改配色方案。从那里,选择 `Monochromatic` 选项并按回车键保存更改:
![在 Linux 中更改 htop 颜色][14]
现在,返回到设置选项,然后使用向左方向键探索可用的指标:
![探索 htop 中可用的指标][15]
因为我打算添加日期和时间,所以我必须在找到它的选项后按回车键。
在这里,它允许你将日期和时间放置在左右两列中,你可以使用向上和向下的方向键更改列的顺序。
所以我将日期和时间指标放在最后一个样式选项中(你可以使用空格键更改样式):
![在 htop 中添加日期和时间][16]
完成日期和时间指标的对齐后,按回车键保存更改,然后按 `F10` 关闭设置提示。
### 总结
在本指南中,我解释了如何在不同的 Linux 发行版中安装 `htop` 实用程序,以及如何使用 `htop` 的一些基本功能来有效的管理系统资源。
但是 `htop` 可以做更多的事情,要了解更多信息,你可以随时参考它的手册页,我们有一个详细的指南,告诉你如何 [在 Linux 中充分利用手册页][17]。
--------------------------------------------------------------------------------
via: https://itsfoss.com/use-htop/
作者:[Sagar Sharma][a]
选题:[lkxed][b]
译者:[perfiffer](https://github.com/perfiffer)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sagar/
[b]: https://github.com/lkxed
[1]: https://itsfoss.com/linux-system-monitoring-tools/
[2]: https://linuxhandbook.com/top-command/
[3]: https://github.com/htop-dev/htop
[4]: https://itsfoss.com/content/images/wordpress/2022/11/install-and-use-htop.png
[5]: https://itsfoss.com/content/images/wordpress/2022/11/cpu-process-in-htop-1.png
[6]: https://itsfoss.com/content/images/wordpress/2022/11/memory-bar-in-htop.png
[7]: https://itsfoss.com/content/images/wordpress/2022/11/task-statistics-in-htop.png
[8]: https://itsfoss.com/content/images/wordpress/2022/11/sort-processes-in-htop-using-keyboard-shortcut.png
[9]: https://itsfoss.com/content/images/wordpress/2022/11/search-processes-in-htop.png
[10]: https://itsfoss.com/content/images/wordpress/2022/11/filter-processes-in-htop.png
[11]: https://itsfoss.com/content/images/wordpress/2022/11/kill-process-in-htop.png
[12]: https://linuxhandbook.com/termination-signals/
[13]: https://itsfoss.com/content/images/wordpress/2022/11/customize-htop-in-ubuntu.png
[14]: https://itsfoss.com/content/images/wordpress/2022/11/change-htop-colors-in-linux.png
[15]: https://itsfoss.com/content/images/wordpress/2022/11/explore-available-meters-in-htop.png
[16]: https://itsfoss.com/content/images/wordpress/2022/11/add-date-and-time-htop.png
[17]: https://linuxhandbook.com/man-pages/
[0]: https://img.linux.net.cn/data/attachment/album/202303/14/162909klvn2plolhwcko2k.jpg

View File

@ -0,0 +1,193 @@
[#]: subject: "A data scientist's guide to open source community analysis"
[#]: via: "https://opensource.com/article/22/12/data-scientists-guide-open-source-community-analysis"
[#]: author: "Cali Dolfi https://opensource.com/users/cdolfi"
[#]: collector: "lkxed"
[#]: translator: "Chao-zhi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15640-1.html"
数据科学家的开源社区分析指南
======
![][0]
> 研究一下这个框架,来建立你自己的开源项目的数据分析。
在数据分析的黄金时代,开源社区也不能免俗。大家都热衷于将一些华丽的数字放到演示幻灯片上,但如果你掌握了正确的分析方法,这些信息可以为你带来更大的价值。
或许你认为作为一名 [数据科学家][1],我会告诉你数据分析和自动化能为你的社区决策提供信息。但实际上,情况恰恰相反。利用数据分析来构建你现有的开源社区知识,吸收其他的知识,并发现潜在的偏见和没有思考过的观点。你或许是实施社区活动的专家,而你那些同事则是代码方面的专家。当你们每个人都在自己的知识背景下将信息可视化时,你们都可以从这些信息中受益。
让我们来面对现实吧。每个人都有一千零一件事情要做,而且总感觉一天的时间永远不够用。如果需要几个小时才能得到你的社区的答案,你就不可能有足够的精力去解决这些事情。但是,花时间创建一个全面发展的可视化项目,可以帮助你时刻掌握你所关心的社区的不同方面,这就将你从精疲力尽中解放了出来。
随着“数据驱动”思维的盛行,围绕开源社区的信息宝库可能是一种祝福,也可能是一种诅咒。下面我将分享一些方法,告诉你如何从数据干草堆中挑出有价值的信息。
### 你的预期是什么?
当考虑一个指标时,首先要明确你想提供的观点。以下是几个可能涉及的概念:
**告知性和影响性的行动:** 你的社区是否存在某个领域尚未被理解?你是否已迈出第一步?你是否试图确定特定方向?你是否正在衡量现有倡议的效果?
**暴露需要改进的领域和突出优势:** 有时你想宣传你的社区,突出它的优势,特别是在试图证明商业影响或为项目宣传时。然而,当涉及到向社区内部传递信息时,你通常需要从一堆指标中精准的找到你们的缺点,以此来帮助你们改进。虽然突出优点并非不可取,但需要在适当的时间和地点。不要把优势指标作为社区内部的拉拉队,告诉每个人都有多棒,而是要与外界分享,以获得认可或推广。
**社区和商业影响:** 数字和数据是许多企业的语言。但是这可能使得为你的社区进行宣传并真正展示其价值变得异常困难。数据可以成为用他们的语言说话的一种方式,并展示他们想看到的东西,以使你数据背后的潜在含义能够被有效转达。另一个角度是对开源的整体影响。你的社区是如何影响他人和生态系统的?
这些观点并非非此即彼,而是相互关联的。适当的框架将有助于创造一个更深思熟虑的衡量标准。
![数据科学和机器学习的工作流程][2]
当人们谈论通用的数据科学或机器学习工作时,通常会描述这样的工作流程。我将重点关注第一步,即编写问题和度量标准,并简要提及第二步。从数据科学的角度来看,这个演示可以被视为这个步骤的一个案例研究。这一步有时会被忽视,但你的分析的实际价值始于此。你不能一天醒来就知道要看什么。从理解你想知道什么和你所拥有的数据开始,逐步实现更加深度的数据分析。
### 3个开源数据分析用例
以下是您在开源数据分析过程中可能遇到的三种不同场景。
#### 场景 1现有数据分析
假设你开始进行分析,并且已经知道你将要研究的内容对你或你的社区是有用的。那么你该如何提高分析的价值呢?这里的想法是建立在“传统”的开源社区分析基础之上。假设你的数据表明,在项目的整个生命周期内,你共有 120 个贡献者。这是你可以放在幻灯片上的价值,但你不能从中做出决策。从仅有一个数字到获得洞见,逐步采取措施。例如,你可以从相同的数据中将贡献者分为活跃和流失的贡献者(那些已经有一段时间没有做出贡献的贡献者),以获得更深入的了解。
#### 场景 2社区活动的影响测量
![目标和影响][3]
针对聚会、会议或其他任何社区外联活动,你如何看待你的影响力和目标?这两个步骤实际上互相影响。一旦你确定了活动的目标,就要确定可以用什么来检测效果。这些信息有助于设定活动的目标。在活动开始时,很容易陷入模糊的计划而非具体的计划的陷阱中。
#### 场景3形成新的影响分析区
![新的分析区][4]
当你从头开始进行数据分析时,就会出现这种情况。前面的例子是这个工作流程的不同部分。这个工作流程是一个不断发展的循环;你可以随时进行改进或扩展。基于这个概念,以下是你应该经历的必要步骤。在本文的后面,将会有三个不同的例子,展示这种方法在现实世界中的应用。
#### 第一步:分解关注区和视角
首先,想象一下魔法 8 球——你可以问任何问题,摇一摇,就能得到答案的玩具。考虑你的分析领域。如果你能立即得到任何答案,那会是什么?
接下来,考虑数据。从你的魔法 8 球问题中,哪些数据源可能与问题或关注领域有关?
在数据背景下,哪些问题可以回答,让你更接近你提出的魔法 8 球问题?需要注意的是,如果你试图将所有的数据汇集在一起,你必须考虑到所做出的假设。
#### 第二步:将问题转化为指标
以下是第一步中每个子问题的处理过程:
- 选择所需的具体数据点。
- 确定可视化以实现目标分析。
- 假设这些信息的影响。
接下来,引入社区提供反馈并触发迭代开发过程。这个协作部分可能就是真正的魔力所在。最好的想法通常是在将一个概念带给某个人时产生的,会激发他们的灵感,这是你或他们无法想象的。
#### 第三步:分析实践
这一步是你开始处理你所创建的指标或可视化的影响。
首先要考虑的是,这个度量标准是否符合当前对社区的了解。
- 如果**是**:是否有假设得出的结果?
- 如果**不是**:你需要进一步调查,是否这是一个潜在的数据或计算问题,或者只是先前被误解的社区的一部分。
一旦你确定你的分析足够稳定,可以开始在信息上实施社区倡议。当你正在进行分析以确定下一步最佳步骤时,你应该确定衡量倡议成功的具体方法。
现在,观察这些由你的指标提供信息的社区倡议。确定是否可以用你之前建立的成功衡量指标观察到影响。如果没有,可以考虑以下几点:
- 你是否在衡量正确的事情?
- 倡议战略是否需要调整?
### 分析区的例子:新贡献者
#### 魔法 8 球问题是什么?
- 如何分析哪些人为持续的贡献者?
#### 我有什么数据可以纳入分析区和魔法 8 球问题?
- 仓库存在哪些贡献者的活动,包括时间戳?
现在你有了这些信息和一个魔法 8 球问题,把分析分成几个子部分执行。这个想法与上述步骤 2 和 3 相关。
**子问题 1:** “人们是怎么进入这个项目的”
这个问题的目的是先看看新的贡献者在做什么。
**数据:** GitHub 上的首次贡献随时间推移的数据议题、PR、评论等
![每季度首次贡献图表][5]
**可视化:** 按季度划分的首次贡献条形图。
**潜在的意义:** 在你与其他社区成员交谈后,进一步检查按季度细分的信息,以及贡献者是否为重复贡献者或仅仅是路过。你可以看到人们进来的时候在做什么,以及这是否能告诉你他们是否会留下来。
![每季度路过贡献图标][6]
**从这些信息中了解到的可以采取的行动。**
- 目前的文档是否能够帮助到最常见的新手?你能不能更好地帮助和支持新人朋友,这将有助于他们中更多的人留下来?
- 是否有一个贡献领域在整体上并不常见,但重复贡献者却集中在这个区域?也许 PR 是重复贡献者的一个常见区域,但大多数人却不在这个区域工作。
**行动项目:**
- 给 “好的第一个问题” 贴上一致的标签,并将这些问题链接到贡献文档中。
- 在这些问题上添加一个 PR 伙伴。
**子问题 2** “我们的代码库真的依赖于路过的贡献者吗?”
**数据:** GitHub 的贡献数据。
![贡献者类型随时间变化的图表][7]
**可视化:** “贡献总额:按路过和重复贡献者的贡献进行细分。”
**根据这一信息可能采取的行动。**
- 这个比例是否达到了项目的目标?很多工作都是由路过贡献者完成的吗?这是否是一种未被充分利用的资源,项目是否没有尽到自己的责任来吸引他们?
### 分析:吸取教训
数字和数据分析并不是“事实”,它们可以支持任何观点。因此,在处理数据时,内部怀疑者应该非常积极,并进行反复迭代,以带来真正的价值。你不希望你的分析只是一个 “yes man”因此花点时间退一步评估你所做的假设。
如果一个指标只是指出了调查的方向,那也是一个巨大的胜利。你不可能看清或想到所有的事情,兔子洞可以是一个好事,对话的起点可以把你带到一个新的地方。
有时,你想测量的东西恰恰不在那里,但你也许能得到有价值的细节。不要假设你有所有的拼图碎片来获得你最初问题的准确答案。如果你开始强迫一个答案或解决方案,你会把自己带入一条由假设引领的危险道路。为分析的方向或目标的改变留出空间,可以让你获得比最初的想法更好的洞察力。
数据只是是一种工具,并不是标准答案,它可以汇集原本无法获得的见解和信息。将你想知道的东西分解成可管理的小块,并在此基础上进行分析,这是最重要的部分。
开源数据分析是一个很好的例子,说明你必须对所有的数据科学采取谨慎态度。
- 主题领域的细微差别是最重要的。
- 通过“问什么/答什么”的工作过程经常被忽视。
- 知道“问什么”可能是最难的部分,当你想出一些有洞察力和创新的东西时,这比你选择的任何工具都要重要。
如果你是一个没有数据科学经验的社区成员,正在寻找开始的地方,我希望这些信息能告诉你,你在这个过程中是多么重要和宝贵。你带来了社区的洞察力和观点。如果你是一个数据科学家或实施指标或可视化的人,你必须倾听你周围的声音,即使你也是一个活跃的社区成员。关于数据科学的更多信息列在本文的最后。
### 总结
把上面的例子作为建立你自己的开源项目的数据分析的框架。对你的结果有很多问题要问,知道这些问题和它们的答案可以把你的项目引向一个令人兴奋和富有成效的方向。
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/12/data-scientists-guide-open-source-community-analysis
作者:[Cali Dolfi][a]
选题:[lkxed][b]
译者:[Chao-zhi](https://github.com/Chao-zhi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/cdolfi
[b]: https://github.com/lkxed
[1]: https://enterprisersproject.com/article/2022/9/data-scientist-day-life?intcmp=7013a000002qLH8AAM
[2]: https://opensource.com/sites/default/files/2022-11/datascience-machinelearning-workflow.jpg
[3]: https://opensource.com/sites/default/files/2022-11/goals-impact.png
[4]: https://opensource.com/sites/default/files/2022-11/new-analysis-areas.png
[5]: https://opensource.com/sites/default/files/2022-11/first-time-contributions-per-quarter.png
[6]: https://opensource.com/sites/default/files/2022-11/driveby-contributions-per-quarter.png
[7]: https://opensource.com/sites/default/files/2022-11/contributor-types-over-time.png
[8]: https://opensource.com/resources/data-science?intcmp=7013a000002CxqkAAC
[9]: https://opensource.com/resources/python?intcmp=7013a000002CxqkAAC
[10]: https://opensource.com/article/17/9/data-scientist?intcmp=7013a000002CxqkAAC
[11]: https://enterprisersproject.com/article/2022/9/data-scientist-day-life?intcmp=7013a000002CxqkAAC
[12]: https://opensource.com/resources/big-data?intcmp=7013a000002CxqkAAC
[13]: https://www.redhat.com/en/resources/data-intensive-applications-hybrid-cloud-blueprint-detail?intcmp=7013a000002CxqkAAC
[14]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet?intcmp=7013a000002CxqkAAC
[15]: https://opensource.com/tags/data-science?intcmp=7013a000002CxqkAAC
[0]: https://img.linux.net.cn/data/attachment/album/202303/19/155043lcx6bxqw5ci5gpgi.jpg

View File

@ -0,0 +1,265 @@
[#]: subject: "How I use my old camera as a webcam with Linux"
[#]: via: "https://opensource.com/article/22/12/old-camera-webcam-linux"
[#]: author: "Tom Oliver https://opensource.com/users/tomoliver"
[#]: collector: "lkxed"
[#]: translator: "Pabloxllwe"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15648-1.html"
如何在 Linux 中使用旧相机作为网络摄像头
======
![][0]
> 我用 gphoto2 给我的旧单反相机带来了新的生命,把它变成了 Linux 电脑的网络摄像头。
今年,在我基本上放弃了 MacBook转而使用 NixOS 机器之后,我开始在与人进行视频通话时被要求“打开摄像头”。这是一个问题,因为我没有网络摄像头。我考虑购买一个,但后来我意识到我有一台完好无损的 2008 年产的佳能 EOS Rebel XS 数码单反相机放在书架上。这台相机有一个 mini-USB 接口,所以我自然而然地思考:一台数码单反相机、一个 mini-USB 接口和一台台式电脑,是否意味着我能拥有一个网络摄像头?
只有一个问题。我的佳能 EOS Rebel XS 不能录制视频。它可以拍摄一些漂亮的照片,仅此而已。所以这结束了?
还是有别的办法?
恰好有一个叫做 [gphoto2](http://gphoto.org/) 的神奇的开源软件。一旦安装,它允许你从计算机控制各种支持的相机,并拍摄照片和视频。
### 支持的相机
首先,了解你的设备是否得到支持:
```
$ gphoto2 --list-cameras
```
### 拍摄图像
你可以用它拍照:
```
$ gphoto2 --capture-image-and-download
```
快门触发,图像会保存到你当前的工作目录中。
### 录制视频
我意识到了这里的潜力,所以尽管我的相机没有视频功能,我还是决定尝试 `gphoto2 --capture-movie` 命令。不知怎么,尽管我的相机不支持视频功能,`gphoto2` 仍然能够生成一个 MJPEG 文件!
在我的相机上,我需要将其置于“实时预览”模式下,然后 `gphoto2` 才能录制视频。这包括将相机设置为纵向模式,然后按下 “<ruby>设置<rt>Set</rt></ruby>” 按钮,使取景器关闭,相机屏幕显示图像。不幸的是,这还不足以将其用作网络摄像头。它仍然需要分配一个视频设备,例如 `/dev/video0`
### 安装 ffmpeg 和 v4l2loopback
毫不奇怪,有一个开源的解决方案来解决这个问题。首先,使用你的包管理器安装 `gphoto2`、`ffmpeg` 和 `mpv`。例如,在 Fedora 、CentOS 、Mageia 和类似的 Linux 发行版上:
```
$ sudo dnf install gphoto2 ffmpeg mpv
```
在 Debian、Linux Mint 及其类似发行版:
```
$ sudo apt install gphoto2 ffmpeg mpv
```
我使用的是 NixOS这是我的配置文件
```
# configuration.nix
...
environment.systemPackages = with pkgs; [
  ffmpeg
  gphoto2
  mpv
...
]
```
创建虚拟视频设备需要使用 `v4l2loopback` Linux 内核模块。在撰写本文时,该功能未包含在主线内核中,因此你需要自己下载和编译它:
```
$ git clone https://github.com/umlaeute/v4l2loopback
$ cd v4l2loopback
$ make
$ sudo make install
$ sudo depmod -a
```
如果你像我一样使用 NixOS ,你可以在 `configuration.nix` 中添加额外的模块包:
```
[...]
boot.extraModulePackages = with config.boot.kernelPackages;
[ v4l2loopback.out ];
boot.kernelModules = [
  "v4l2loopback"
];
boot.extraModprobeConfig = ''
  options v4l2loopback exclusive_caps=1 card_label="Virtual Camera"
'';
[...]
```
在 NixOS 上, 运行 `sudo nixos-rebuild switch`,然后重启。
### 创建一个视频设备
假设你的计算机当前没有 `/dev/video` 设备,你可以借助 `v4l2loopback` 在需要时创建一个。
运行以下命令,将 `gphoto2` 中的数据发送到 `ffmpeg`,使用设备如 `/dev/video0` 设备:
```
$ gphoto2 --stdout --capture-movie |
 ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
```
你得到的输出是这样的:
```
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.3.0 (GCC)
  configuration: --disable-static ...
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Capturing preview frames as movie to 'stdout'. Press Ctrl-C to abort.[mjpeg @ 0x1dd0380] Format mjpeg detected only with low score of 25, misdetection possible!
Input #0, mjpeg, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 768x512 ...
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native))[swscaler @ 0x1e27340] deprecated pixel format used, make sure you did set range correctly
Output #0, video4linux2,v4l2, to '/dev/video0':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: rawvideo (I420 / 0x30323449) ...
    Metadata:
      encoder         : Lavc58.134.100 rawvideoframe=  289 fps= 23 q=-0.0 size=N/A time=00:00:11.56 bitrate=N/A speed=0.907x
```
要查看来自网络摄像头的视频,请使用 `mpv` 命令:
```
$ mpv av://v4l2:/dev/video0 --profile=low-latency --untimed
```
![Streaming a live feed from the webcam][2]
### 自动启动你的网络摄像头
每次想使用网络摄像头时都需要执行一次命令有点麻烦。幸运的是,你可以在启动时自动运行此命令。我将其实现为一个 `systemd` 服务:
```
# configuration.nix
...
  systemd.services.webcam = {
    enable = true;
    script = ''
      ${pkgs.gphoto2}/bin/gphoto2 --stdout --capture-movie |
        ${pkgs.ffmpeg}/bin/ffmpeg -i - \
            -vcodec rawvideo -pix_fmt yuv420p -f v4l2  /dev/video0
    '';
wantedBy = [ "multi-user.target" ];
  };
...
```
在 NixOS 上,运行 `sudo nixos-rebuild switch`,然后重新启动你的计算机。你的网络摄像头已经开启并处于活动状态。
要检查是否存在任何问题,可以使用 `systemctl status webcam` 命令。它会告诉你服务最后一次运行的时间,并提供其以前输出的日志。这对于调试非常有用。
### 迭代以使其变得更好
止步于此也许很诱人。但是,考虑到当前的全球危机,我们可能需要思考是否有必要一直开着网络摄像头。这让我感到不太理想,原因如下:
- 这浪费电。
- 这类事情涉及隐私问题。
我的摄像头有一个镜头盖,所以说实话,第二个原因并不真的让我感到困扰。当我不使用网络摄像头时,我总是可以把镜头盖上。然而,让一个耗电量大的单反相机整天开着(更不用说需要解码视频所需的 CPU 开销),对我的电费并没有任何好处。
理想情况是:
- 我一直把相机插在电脑上,但是关闭的。
- 当我想使用网络摄像头时,我按下相机的电源按钮将其打开。
- 我的计算机会检测到相机并启动 systemd 服务。
- 使用网络摄像头完成后,我再次将其关闭。
为了实现这一点,你需要使用一个自定义的 udev 规则。
udev 规则可以告诉你的计算机,当它发现某个设备已经可用时执行某个任务。这可以是外部硬盘甚至是非 USB 设备。在这种情况下,你需要通过其 USB 连接识别相机。
首先,指定 udev 规则被触发时要运行的命令。你可以用一个 shell 脚本来完成(`systemctl restart webcam` 应该可以工作)。我运行的是 NixOS所以我只需要创建一个派生包一个 Nix 包),它会重新启动 systemd 服务:
```
# start-webcam.nix
with import <nixpkgs> { };
writeShellScriptBin "start-webcam" ''
  systemctl restart webcam
  # debugging example
  # echo "hello" &> /home/tom/myfile.txt
  # If myfile.txt gets created then we know the udev rule has triggered properly''
```
接下来,实际定义 udev 规则。查找摄像头的设备和厂商 ID。使用 `lsusb` 命令可以完成此操作。该命令可能已经安装在你的发行版上,但我不经常使用它,因此我只需要根据需要使用 `nix-shell` 安装它:
```
$ nix-shell -p usbutils
```
无论你的计算机上已经安装了它,还是刚刚安装,请运行 `lsusb`
```
$ lsusb
Bus 002 Device 008: ID 04a9:317b Canon, Inc. Canon Digital Camera[...]
```
在此输出中,厂商 ID 为 `04a9`,设备 ID 为 `317b`。这已足以创建 udev 规则:
```
ACTION=="add", SUBSYSTEM=="usb",
ATTR{idVendor}=="04a9",
ATTR{idProduct}=="317b",
RUN+="/usr/local/bin/start-webcam.sh"
```
或者,如果你使用的是 NixOS
```
# configuration.nix[...]let
  startWebcam = import ./start-webcam.nix;[...]
services.udev.extraRules = ''
  ACTION=="add",  \
  SUBSYSTEM=="usb", \
  ATTR{idVendor}=="04a9", \
  ATTR{idProduct}=="317b",  \
  RUN+="${startWebcam}/bin/start-webcam"'';[...]
```
最后,在你的 `start-webcam` systemd 服务中删除 `wantedBy = ["multi-user.target"];` 这一行。(如果保留它,则无论相机是否开启,该服务都会在下次重启时自动启动。)
### 重复使用旧技术
我希望这篇文章能让你在放弃一些旧技术之前三思而后行。Linux 可以为技术注入活力,无论是你的电脑还是数码相机或其他外围设备等简单的东西。
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/12/old-camera-webcam-linux
作者:[Tom Oliver][a]
选题:[lkxed][b]
译者:[Pabloxllwe](https://github.com/Pabloxllwe)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/tomoliver
[b]: https://github.com/lkxed
[1]: https://opensource.com/article/20/7/gphoto2-linux
[2]: https://opensource.com/sites/default/files/2022-12/streaming-webcam.png
[3]: https://opensource.com/article/18/11/udev
[4]: https://opensource.com/article/22/1/cameras-usb-ports-obs
[5]: https://opensource.com/article/22/4/how-linux-saves-earth
[0]: https://img.linux.net.cn/data/attachment/album/202303/21/233633z1qxdoq1shrx1xmc.jpg

View File

@ -3,20 +3,24 @@
[#]: author: "David Both https://opensource.com/users/dboth"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15607-1.html"
在 Linux 命令行上使用 dict 文字工具
======
![][0]
> Linux 上的 dict 命令对作家来说非常有用,可以为他们的选词提供大量的字典和同义词。
作为一个作家,我经常需要确定单词的正确拼写或定义。我还需要使用词库来寻找替代词,这些词的内涵可能与我可能使用的词有些不同。因为我经常使用 Linux 命令行和文本模式工具来完成我的大部分工作,所以使用命令行词典是有意义的。
我非常喜欢使用命令行,原因有很多,其中最主要的原因是它对我来说更有效率。它也比任何一本或多本实体纸质字典,都要全面得多。我使用 Linux 的 `dict` 命令已经很多年了,我已经开始依赖它了。
### 在 Linux 上安装 dict
dict 程序在 Fedora 上没有默认安装,但它很容易安装。以下是如何在 Fedora 或类似发行版上安装:
`dict` 程序在 Fedora 上没有默认安装,但它很容易安装。以下是如何在 Fedora 或类似发行版上安装:
```
$ sudo dnf install dictd
@ -24,12 +28,11 @@ $ sudo dnf install dictd
在 Debian 和类似发行版上,你还必须安装字典定义:
```
$ sudo apt install dictd dict-gcide
```
不需要额外的配置。简单的 `/usr/share/doc/dictd/dict1.conf` 文件指定了字典数据库的远程服务器。这个工具使用字典服务器协议DICT端口为 2628。
不需要额外的配置。这个非常简单的 `/usr/share/doc/dictd/dict1.conf` 文件指定了字典数据库的远程服务器。这个工具使用字典服务器协议DICT端口为 2628。
### 在 Linux 上使用 dict
@ -105,7 +108,7 @@ $ dict "air gapped"
### 字典
`dict` 命令使用一些在线字典,包括法律和技术字典。许多语言的字典也是可用的。你可以`列出`可用的字典数据库,如下面所示:
`dict` 命令使用一些在线字典,包括法律和技术字典。许多语言的字典也是可用的。你可以“列出”可用的字典数据库,如下面所示:
```
$ dict -D | less
@ -143,7 +146,7 @@ $ dict -d gcide
有时使用词库中的词汇并不是最好的写作方法,因为它可能会混淆你的意思。但我确实发现 `dict` 命令在为特定的意思选择最好的词方面有极大的帮助。它还能确保我使用的单词拼写正确。
关于 dict 的信息很匮乏。 这个 URL [http://www.dict.org/][1] 只提供了一个基于网络的字典界面。手册页涵盖了语法。但是这个命令是一个有用的、有趣的命令,可以随身携带。我承认在发现 `dict` 命令后我花了很多时间尝试不同的东西看看结果会是什么。我就是那个读百科全书和字典的孩子。是的我是_那个_孩子。除了在写作或阅读时是一个有用的工具外dict 也可以是一个有趣的工具来满足一下好奇心。
关于 dict 的信息很匮乏。 这个 URL [http://www.dict.org/][1] 只提供了一个基于网络的字典界面。手册页涵盖了语法。但是这个命令是一个有用的、有趣的命令,可以随身携带。我承认在发现 `dict` 命令后,我花了很多时间尝试不同的东西,看看结果会是什么。我就是那个读百科全书和字典的孩子。是的我是_那个_孩子。除了在写作或阅读时是一个有用的工具外`dict` 也可以是一个有趣的工具来满足一下好奇心。
--------------------------------------------------------------------------------
@ -152,11 +155,11 @@ via: https://opensource.com/article/23/2/linux-dict-command
作者:[David Both][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/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lkxed
[1]: http://www.dict.org/
[0]: https://img.linux.net.cn/data/attachment/album/202303/08/152653jojqqmv7x7wxzox7.jpg

View File

@ -0,0 +1,347 @@
[#]: subject: "Beginner's Guide to R Markdown Syntax [With Cheat Sheet]"
[#]: via: "https://itsfoss.com/r-markdown/"
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
[#]: collector: "lkxed"
[#]: translator: "lxbwolf"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15627-1.html"
R Markdown 语法新手指南
======
![][0]
你可能已经了解过轻量级标记语言 Markdown。如果你是第一次接触这个概念请参考我们的 [Markdown 指南][1]。概括来讲,它是一种用于创建纯文本文档的简单又高效的语言。
然而Markdown 在制作详细的报告或技术文件方面可能还不够完善。
受益于 [knitr][2] 和 Pandoc 等软件包,**交互式文件格式 R Markdown** 早在 2014 年就出现了。它将纯文本与内嵌的 R 代码相结合,可以制作动态文件。
你可以使用 [各种 IDE][4] 和扩展来创建 R Markdown 文档,官方 IDE 为 **RStudio**。因此,在这篇文章中,我们将重点介绍**使用 RStudio 学习 R Markdown 语法**。
> 💡(假如你没有了解过,)**R 编程语言** 是一种用于统计计算、图形表示和报告的语言。
### 配置 RStudio
通过合适的配置,你可以很轻松地用 RStudio 来编写 R Markdown。只需要安装一个软件包就已经完成了大部分的工作
安装 RStudio 后,在 “<ruby>工具<rt>Tools</rt></ruby>” 菜单中选择 “<ruby>安装软件包<rt>Install Packages</rt></ruby>” 选项。
![在 RStudio 的工具菜单下选择安装软件包选项][7]
在弹出的对话框中,搜索 “rmarkdown” 并安装。
![通过搜索并在新的软件包安装对话框中按下安装按钮来安装 Rmarkdown 软件包][8]
>💡 如果你想使用类似 Python 的代码块你需要安装额外的包。当你想在你的文档中包含这些包时RStudio 会提示你安装所需的包。
安装完成后,你可以通过选择 “<ruby>文件<rt>File</rt></ruby> > <ruby>新建文件<rt>New File</rt></ruby> > R Markdown” 来新建一个 R Markdown 文档。
![从文件菜单中创建一个新的 RMarkdown 文档][9]
之后会提示你添加一些关于文件的信息(文件的元数据),把这些填上就可以了。
![用 R Markdown 语法写出标题和其他细节][10]
或者你可以创建一个空的文件从零开始。
### RMarkdown 语法
由于它是 “加强版的 Markdown”因此大多数语法与 Markdown 是一样的。
它还有一些 Markdown 支持不完善的东西,比如**表格、数学方程式、代码块等等**。
下面是我们要介绍的内容的概括:
| RMarkdown 块名 | 语法 |
| - | - |
| 标题 | `# 一级标题` <br> `## 二级标题` <br> `### 三级标题` <br> `一级标题` <br> `=======` <br> `二级标题` <br> `-------` |
| 着重 | `*斜体*` <br> `_斜体_` <br> `**加粗**` <br> `__加粗__` |
| 列表 | 无序列表:<br> `* 列表项` <br> `* 列表项` <br> ` + 子项` <br> ` + 子项` <br>有序列表:<br> `1. 列表项` <br> `2. 列表项` <br> ` + 子项` <br> ` + 子项` |
| 代码块 | 普通代码块:<br> \`\`\` <br> `这里写代码` <br> \`\`\` <br>R 代码块: <br> \`\`\`{r} <br> `R 代码` <br> \`\`\` <br>你也可以用其他的语言 <br> 行内 \`代码\` |
| 链接 | 普通链接:粘贴 URL <br >带标题的链接:`[显示的文本](URL_地址)` <br> 跳转到锚点: `[显示的文本](#锚点)` |
| 表格 | `| 列名 | 列名 | 列名 |` <br> `| ------ | ------ | ------ |` <br> `| 项内容 | 项内容 | 项内容 |` <br> `| 项内容 | 项内容 | 项内容 |` |
| 方程式 | 行内方程式 `$Equations$` <br> 展示方程式: `$$Equations$$` |
| 图片 | 无标题: `![](图片链接)` <br> 有标题:`![可选标题](图片地址)` |
| 引用块 | `> 输入你引用的内容` |
| 其他 | 上角标:`文本内容^上角标^` <br> 章或页水平分割线 <br> `=========``----------` <br>行尾输入两个以上空格,即可添加人工行分割 |
#### YAML 头
在一个 R Markdown 文档的顶部,有一个 YAML 头,被两行 `---` 包围。这个块定义了文档的最终样式,通常包含一个标题、作者、日期和你想输出的文件类型。
支持的文件格式有三种:**HTML、PDF 和 Word**。
```
---
title: "Sample"
author: "It's FOSS"
date: "2023-02-08"
output: pdf_document
---
```
这可以在 RStudio 中设置新文件时添加,如上节所示。
#### 标题
在 R Markdown 中,有两种方法指定标题。我们可以使用 `#` 字符来表示不同级别的标题,比如:
```
# Heading Level 1
## Heading Level 2
### Heading Level 3
#### Heading Level 4
##### Heading Level 5
###### Heading Level 6
```
也可以用 `=``-` 分别表示一级和二级标题。
```
一级标题
===============
二级标题
---------------
```
![rmarkdown 文件中不同等级的标题][11]
#### 列表
有两种列表,一种是**无序列表**,用点句符来表示:
```
* Item 1
* Item 2
+ Sub 1
+ Sub 2
* Item 3
```
另一种是**有序列表**,用数字来排序:
```
1. Item 1
2. Item 2
+ Sub 1
+ Sub 2
3. Item 3
```
![有序和无序列表示例][12]
#### 段落中的文本格式
格式化文本有几种方式。
![][15]
你可以使用斜体或加粗来着重表示文本:
- 斜体:在文本前后各输入一个星号或下划线
- 加粗:在文本前后各输入两个星号或下划线
```
*这里是斜体内容*
_这里是斜体内容_
**这里是加粗内容**
__这里是加粗内容__
```
> 📋 你可以阅读我们的文章 [Markdown 中怎么让内容变成加粗和斜体][16] 来了解更多内容。
如果你想使用上角标,在想变成上角标的内容前后加上 `^` 符号。
```
普通文本内容^上角标^
```
如果你想对文本内容加删除线,在文本前后加 `~~` 符号。
```
~~被删除的内容~~
```
![][17]
#### 添加代码块
内嵌代码是 R Markdown 最主要的设计目的。我们有几种添加代码的方式。
##### 添加普通代码块
如果你想添加一个代码块来与其他的文本进行区分,可以使用下面的语法:
````
```
这里输入你的代码
```
````
你也可以尝试 [对添加的代码进行高亮显示][18]。
如果你想添加代码并将其输出嵌入到文档中,你可以在后面加上语言,并用大括号包裹:
````
```{语言}
这里输入你的代码
```
````
你可以用 ` 符号来添加行内代码。
```
这里是 `行内代码`
```
它看起来是这样的:
![][19]
#### 链接
如果想添加普通文本链接,把它粘贴到行内就可以了。
```
https://itsfoss.com
```
添加超链接,使用下面的语法:
```
[文本内容](URL 地址)
```
当你想链接到本页内的某个锚点时,使用下面的语法:
```
[文本内容](#锚点名称)
```
![][20]
#### 表格
表格的语法与 Markdown 相似:
```
| 列表 | 列表 | 列表 |
| --- | --- | --- |
|表格项|表格项|表格项|
|表格项|表格项|表格项|
```
![][21]
> 📋 还想了解更多?请阅读我们的 [用 Markdown 创建表格][22] 指南。
#### 图片
添加图片使用下面的语法:
```
![](http://example.com/logo.png)
```
```
![可选显示文本](figures/img.png)
```
![][23]
#### 块引用
RMarkdown 可以添加块引用。在被引用的行或段落前添加 `>`(大于号)。
```
这里是普通文本内容。
> 这里是块引用
```
![][24]
> 📋 如果你想了解更多块引用的内容,请阅读我们的 [Markdown 引用][25] 指南。
#### 方程式
你可以用 RMarkdown 来添加方程式和展示复杂的 LaTex 方程式。
例如:
```
行内方程式:$Equation$
展示方程式:$$Equation$$
```
![在 R Markdown 文档中添加方程式][26]
#### 章或页水平分割线
使用三个以上星号或减号来添加章或页水平分割线。
```
************
------------
```
你可以在行尾添加两个以上的空格来添加人工行分割。
### R Markdown 非常有用(备忘录)
![][27]
> **[R Markdown 备忘录.pdf 下载文档][28]**
_💬 你还知道其他关于 R Markdown 的内容吗请在下面的评论区告诉我们。_
--------------------------------------------------------------------------------
via: https://itsfoss.com/r-markdown/
作者:[Sreenath][a]
选题:[lkxed][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sreenath/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/markdown-guide/
[2]: https://www.r-project.org/nosvn/pandoc/knitr.html
[4]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[5]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
[6]: https://itsfoss.com/content/images/wordpress/2019/06/install-r-on-ubuntu.jpg
[7]: https://itsfoss.com/content/images/2023/02/select-install-packages.png
[8]: https://itsfoss.com/content/images/2023/02/install-rmarkdown-1.png
[9]: https://itsfoss.com/content/images/2023/02/new-r-markdown.png
[10]: https://itsfoss.com/content/images/2023/02/new-document-in-rmark.png
[11]: https://itsfoss.com/content/images/2023/02/Headings.png
[12]: https://itsfoss.com/content/images/2023/02/List.png
[13]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
[14]: https://itsfoss.com/content/images/wordpress/2022/01/glow-cli-markdown.png
[15]: https://itsfoss.com/content/images/2023/02/emphasis.png
[16]: https://itsfoss.com/markdown-bold-italic/
[17]: https://itsfoss.com/content/images/2023/02/superescript.png
[18]: https://itsfoss.com/markdown-code-block/
[19]: https://itsfoss.com/content/images/2023/02/code-chunk.png
[20]: https://itsfoss.com/content/images/2023/02/links.png
[21]: https://itsfoss.com/content/images/2023/02/table.png
[22]: https://itsfoss.com/markdown-table/
[23]: https://itsfoss.com/content/images/2023/02/images.png
[24]: https://itsfoss.com/content/images/2023/02/block-quotes.png
[25]: https://itsfoss.com/markdown-quotes/
[26]: https://itsfoss.com/content/images/2023/02/equations.png
[27]: https://itsfoss.com/content/images/2023/02/R-Markdown-Cheat-Sheet.webp
[28]: https://itsfoss.com/content/files/2023/02/R-Markdown-Cheat-Sheet.pdf
[0]: https://img.linux.net.cn/data/attachment/album/202303/15/090943m64sk4k496l4f99q.jpg

View File

@ -0,0 +1,195 @@
[#]: subject: "Writing Javascript without a build system"
[#]: via: "https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/"
[#]: author: "Julia Evans https://jvns.ca/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15666-1.html"
在没有构建系统的情况下编写 Javascript
======
![][0]
嗨!这周我一直在写一些 Javascript和往常一样当我开始一个新的前端项目时我面临的问题是我是否应该使用构建系统
我想谈谈构建系统对我有什么吸引力,为什么我(通常)仍然不使用它们,以及一些前端 Javascript 库要求你使用构建系统时,为什么我觉得这让我感到沮丧。
我写这篇文章是因为我看到的大多数关于 JS 的文章都假定你正在使用构建系统,而对于像我这样的人来说,编写非常简单的、不需要构建系统的小型 Javascript 项目时,构建系统可能反而添加了很多麻烦。
#### 什么是构建系统?
构建系统的思路是,你有一堆 Javascript 或 Typescript 代码,你想在把它放到你的网站上之前把它翻译成不同的 Javascript 代码。
构建系统可以做很多有用的事情,比如:
- (出于效率的考虑)将 100 多个 JS 文件合并成一个大的捆绑文件
- 将 Typescript 翻译成 Javascript
- 对 Typescript 进行类型检查
- 精简化
- 添加 Polyfills 以支持旧的浏览器
- 编译 JSX
- <ruby>摇树优化<rt>Tree Shaking</rt></ruby>(删除不使用的 JS 代码以减少文件大小)
- 构建 CSS像 [tailwind][1] 那样)
- 可能还有很多其他重要的事情
正因为如此,如果你今天正在构建一个复杂的前端项目,你可能会使用 Webpack、Rollup、Esbuild、Parcel 或 Vite 等构建系统。
很多这些功能对我很有吸引力,我过去使用构建系统也是出于这样一些原因: 例如,[Mess With DNS][2] 使用 Esbuild 来翻译 Typescript并将许多文件合并成一个大文件。
#### 目标:轻松地对旧的小网站进行修改
我做了很多简单的小网站([之一][3]、[之二][4]、[之三][5]、[之四][6]),我对它们的维护精力大约为 0而且我改变它们的频率很低。
我的目标是,如果我有一个 3、5 年前做的网站,我希望能在 20 分钟内,
- 在一台新的电脑上从 GitHub 获取源代码
- 做一些修改
- 把它放到互联网上
但我对构建系统(不仅仅是 Javascript 构建系统!)的经验是,如果你有一个 5 年历史的网站,要重新构建这个网站会非常痛苦。
因为我的大多数网站都很小,所以使用构建系统的 *优势* 很小 —— 我并不真的需要 Typescript 或 JSX。我只要有一个 400 行的 `script.js` 文件就可以了。
#### 示例:尝试构建 SQL 实验场
我的一个网站([SQL 试验场][5])使用了一个构建系统(它使用 Vue。我最后一次编辑该项目是在 2 年前,是在另一台机器上。
让我们看看我今天是否还能在我的机器上轻松地构建它。首先,我们要运行 `npm install`。下面是我得到的输出:
```
$ npm install
[lots of output redacted]
npm ERR! code 1
npm ERR! path /Users/bork/work/sql-playground.wizardzines.com/node_modules/grpc
npm ERR! command failed
npm ERR! command sh /var/folders/3z/g3qrs9s96mg6r4dmzryjn3mm0000gn/T/install-b52c96ad.sh
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_stack.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_stack_builder.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_trace.o
npm ERR! CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channelz.o
```
在构建 `grpc` 时出现了某种错误。没问题。反正我也不需要这个依赖关系,所以我可以花 5 分钟把它拆下来重建。现在我可以 `npm install` 了,一切正常。
现在让我们试着构建这个项目:
```
$ npm run build
? Building for production...Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/Users/bork/work/sql-playground.wizardzines.com/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/bork/work/sql-playground.wizardzines.com/node_modules/webpack/lib/NormalModule.js:414:16)
at handleParseError (/Users/bork/work/sql-playground.wizardzines.com/node_modules/webpack/lib/NormalModule.js:467:10)
at /Users/bork/work/sql-playground.wizardzines.com/node_modules/webpack/lib/NormalModule.js:499:5
at /Users/bork/work/sql-playground.wizardzines.com/node_modules/webpack/lib/NormalModule.js:356:12
at /Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array.<anonymous> (/Users/bork/work/sql-playground.wizardzines.com/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/Users/bork/work/sql-playground.wizardzines.com/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at /Users/bork/work/sql-playground.wizardzines.com/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
```
[这个 Stack Overflow 的答案][7] 建议运行 `export NODE_OPTIONS=--openssl-legacy-provider` 来解决这个错误。
这很有效,最后我得以 `npm run build` 来构建这个项目。
这其实并不坏(我只需要删除一个依赖关系和传递一个略显神秘的 Node 选项!),但我宁愿不被那些构建错误破坏。
#### 对我来说,对于小项目来说,构建系统并不值得
对我来说,一个复杂的 Javascript 构建系统对于 500 行的小项目来说似乎并不值得 —— 它意味着放弃了在未来能够轻松更新项目的能力,以换取一些相当微小的好处。
#### Esbuild 似乎更稳定一些
我想为 Esbuild 大声叫好: 我 [在 2021 年了解到 Esbuild][8],并用于一个项目,到目前为止,它确实是一种更可靠的构建 JS 项目的方式。
我刚刚尝试在一台新电脑上构建一个我最后一次改动在 8 个月前的 Esbuild 项目,结果成功了。但我不能肯定的说,两年后我是否还能轻松的建立那个项目。也许会的,我希望如此!
#### 不使用构建系统通常是很容易的
下面是 [Nginx 实验场][6] 代码中导入所有库的部分的样子:
```
<script src="js/vue.global.prod.js"></script>
<script src="codemirror-5.63.0/lib/codemirror.js"></script>
<script src="codemirror-5.63.0/mode/nginx/nginx.js"></script>
<script src="codemirror-5.63.0/mode/shell/shell.js"></script>
<script src="codemirror-5.63.0/mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="codemirror-5.63.0/lib/codemirror.css">
<script src="script.js "></script>
```
这个项目也在使用 Vue但它只是用 `<script src` 来加载 Vue —— 前端没有构建过程。
#### 一个使用 Vue 的无构建系统模板
有几个人问如何在没有构建系统的情况下开始编写 Javascript。当然如果你想的话你可以写原味的 JS但我常用的框架是 Vue 3。
[这是我做的一个小模板][9],用于启动一个没有构建系统的 Vue 3 项目。它只有 2 个文件和大约 30 行的 HTML/JS。
#### 有些库需要你使用构建系统
构建系统这些事情最近盘旋在我的脑海里,因为这周我正在用 CodeMirror 5 做一个新项目我看到有一个新版本CodeMirror 6。
所以我想 —— 很酷,也许我应该使用 CodeMirror 6 而不是 CodeMirror 5。但是 —— 似乎没有构建系统你就不能使用 CodeMirror 6根据 [迁移指南][10]),所以我打算坚持使用 CodeMirror 5。
同样地,你以前可以把 Tailwind 作为一个巨大的 CSS 文件下载,但是 [Tailwind 3][11] 似乎根本不能作为一个大的 CSS 文件使用,你需要运行 Javascript 来构建它。所以我现在要继续使用 Tailwind 2。我知道我知道你不应该使用大的 CSS 文件,但是它验收只有 300KB而且我真的不希望有构建步骤
(更正:看起来 Tailwind 在 2021 年发布了一个 [独立的命令行工具][12],这似乎是一个不错的选择)
我不完全确定为什么有些库不提供无构建系统版本 —— 也许发布无构建系统版本会给库增加很多额外的复杂性,而维护者认为这不值得。或者,库的设计意味着由于某种原因,不可能发布无构建系统版本。
#### 我希望有更多的无构建系统的 Javascript 技巧
到目前为止,我的主要策略是:
- 在某个库的网站上搜索 “CDN”找到一个单独的 Javascript 文件
- 使用 [https://unpkg.com][13] 来查看该库是否有一个我可以使用的内置版本
- 托管我自己的库的版本,而不是依赖可能崩溃的 CDN
- 编写我自己的简单集成方案,而不是拉入另一个依赖关系(例如,前几天我为 Vue 编写了自己的 CodeMirror 组件)。
- 如果我想要一个构建系统,就使用 Esbuild
还有一些看起来很有趣但我还没有研究过的东西:
- 这个 [关于 Javascript 注释中类型语法的 Typescript 建议][14]
- 一般来说ES 模块
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/
作者:[Julia Evans][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://jvns.ca/
[b]: https://github.com/lkxed/
[1]: https://tailwindcss.com/
[2]: https://messwithdns.net/
[3]: https://css-examples.wizardzines.com/
[4]: https://questions.wizardzines.com
[5]: https://sql-playground.wizardzines.com/
[6]: https://nginx-playground.wizardzines.com/
[7]: https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
[8]: https://jvns.ca/blog/2021/11/15/esbuild-vue/
[9]: https://github.com/jvns/vue3-tiny-template
[10]: https://codemirror.net/docs/migration/
[11]: https://tailwindcss.com/docs/installation
[12]: https://tailwindcss.com/blog/standalone-cli
[13]: https://unpkg.com
[14]: https://devblogs.microsoft.com/typescript/a-proposal-for-type-syntax-in-javascript/
[0]: https://img.linux.net.cn/data/attachment/album/202303/27/120324jeqlswqte9exfxhh.jpg

View File

@ -3,30 +3,32 @@
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15606-1.html"
NixOS 系列 #1:你为什么要考虑使用 NixOS
======
NixOS... 又是一个使用不同软件包管理器的发行版?**🤯**
![][0]
好吧NixOS 是[高级 Linux 发行版][1]中的一个。
NixOS……又一个使用不同软件包管理器的发行版🤯
所以如果我写这个,我一定有一个充分的理由,对吗?嗯,有很多
好吧NixOS 是 [高级 Linux 发行版][1] 之一。
所以如果我写这个,我一定有一个充分的理由,对吗?嗯,有很多!
我已经使用它 3 个月了,它是如此之好,以至于我正在考虑从我一直以来最喜欢的 **Pop!_OS 切换到 NixOS**
在本指南中,我将分享 NixOS 在众多 Linux 发行版中脱颖而出的主要特点
在本指南中,我将分享 NixOS 在众多 Linux 发行版中脱颖而出的主要特点。
别担心在我们继续之前让我告诉你什么是NixOS
别担心,在我们继续之前,让我告诉你什么是 NixOS
> 它是一个以 Nix 包管理器为核心的 Linux 发行版,为你省去了在不同 Linux 发行版上设置的麻烦,让你充分利用 Nix 的优势。由开发 Nix 的同一个团队构建。
> 它是一个以 Nix 包管理器为核心的 Linux 发行版,为你省去了在其它的 Linux 发行版上设置 Nix 的麻烦,可以让你充分利用它的优势。由开发 Nix 的同一个团队构建。
### 使用 NixOS 的 6 个理由
NixOS 是一个有趣的从零开始构建的[独立 Linux 发行版][2]。
NixOS 是一个有趣的从零开始构建的 [独立 Linux 发行版][2]。
每个人都可以通过使用 NixOS 学到很多东西,但**在我看来**如果你是一个开发人员或计算机科学的学生NixOS 应该非常合适。
@ -34,7 +36,7 @@ NixOS 是一个有趣的从零开始构建的[独立 Linux 发行版][2]。
让我告诉你为什么。
#### 1. 不易损坏/易于恢复
#### 1不易损坏/易于恢复
就其核心而言NixOS 是为长期使用而构建的。
@ -42,25 +44,25 @@ NixOS 是一个有趣的从零开始构建的[独立 Linux 发行版][2]。
为了理解 NixOS 为何如此稳定让我们谈谈用户一般是如何破坏他们的系统的即“_依赖性问题或软件包冲突_”
在更新系统或安装一个新的软件包时,你一般会面临明显的系统崩溃。主要是因为你的软件包管理器无法满足依赖性,或者安装的软件包与现有系统冲突。
在更新系统或安装一个新的软件包时,你一般会面临系统崩溃的风险。主要是因为你的软件包管理器无法满足依赖性,或者安装的软件包与现有系统冲突导致的
**而 NixOS 有一个非常聪明的方法来处理这个问题**
**而 NixOS 有一个非常聪明的方法来处理这个问题**
你看,每当你升级你的系统或安装一个软件包时,**系统的状态就会被重建**,被称为“**新的一代**”,超过当前的。
你看,每当你升级你的系统或安装一个软件包时,**系统的状态就会被重建**,被称为超过当前的<ruby>新世代<rt>new generation</rt></ruby>
![nix os listing generations via terminal][4]
因此,如果你在使用新的软件包或更新时遇到任何麻烦,你可以随时回滚到旧的一代,在那里你会找到**系统的以前的状态**。
因此,如果你在使用新的软件包或更新时遇到任何麻烦,你可以随时回滚到<ruby>旧世代<rt>old generation</rt></ruby>”,在那里你会找到**系统以前的状态**。
即使系统无法访问,你也能在启动时找到以前几代
即使系统无法访问,你也能在启动时找到以前几代。
#### 2. 可重复性
#### 2可重复性
通过一个配置文件,你可以为其他物理系统创建一个你当前环境的副本。
为了从这个功能中获益,你可以使用 Nix 配置文件进行安装和配置。
这个功能给你带来的好处是,你可以使用 Nix 配置文件进行安装和配置。
当你有了适合你的目的的配置文件,将该文件发送到新的安装中,用你的配置文件替换默认的配置文件。就是这么简单!
当你有了适合你的用途的配置文件,将该文件发送到新的系统中,用你的配置文件替换默认的配置文件。就是这么简单!
**重建配置,升级系统,并通过给定的命令进行切换:**
@ -70,15 +72,15 @@ sudo nixos-rebuild switch --upgrade
你将在几分钟内拥有与你的主机上完全相同的开发环境,并进行复制。
#### 3. 轻松回滚
#### 3轻松回滚
虽然你可能已经从 NixOS 的 “**Generations**” 特性中得到了灵感。
虽然你可能已经从 NixOS 的 “<ruby>世代<rt>generation</rt></ruby>” 特性中得到了灵感。
这还有更多的内容。**🕵️**
但还有更多的内容。🕵️
NixOS 在很大程度上依赖于符号链接。如果这对你来说是一个新概念,请参考下面的指南:
[如何在Linux中创建符号链接完整指南][5]
> **[如何在 Linux 中创建符号链接(完整指南)][5]**
一般来说,在其他 Linux 发行版中,当你升级一个软件包时,新的软件包会取代旧的。
@ -88,41 +90,41 @@ NixOS 在很大程度上依赖于符号链接。如果这对你来说是一个
每当你升级一个软件包时,**NixOS 会调整符号链接来定位新的软件包,但不会删除旧的**。
因此,如果你面临与新包的冲突,只需切换到旧的一代,符号链接有助于定位旧版本的包。😌
因此,如果你面临与新包的冲突,只需切换到旧代,符号链接有助于定位旧版本的包。😌
#### 4. Nix 包管理器
#### 4Nix 包管理器
Nix 包管理器允许你访问超过 80,000 个软件包! 不仅仅局限于 Linux它还可以在 **macOS、WSL2、Docker 等平台**上使用。
Nix 包管理器允许你访问超过 80,000 个软件包不仅仅局限于 Linux它还可以在 **macOS、WSL2、Docker 等平台**上使用。
而且,软件包的可用性与 AUR 相似,甚至比 AUR 更好,因为你应该在 Nix 包管理器上找到几乎所有的东西(我认真的)。
而且,软件包的可用性与 AUR 相似,甚至比 AUR 更好,因为你应该在 Nix 包管理器上找到几乎所有的东西(我认真的)。
例如,我想安装 Librewolf 浏览器,这在大多数 Linux 发行版的默认仓库中是不可用的。
但是Nix 有它! 这意味着你可以依靠 Nix 包管理器来安装几乎所有的软件包。
但是Nix 有它这意味着你可以依靠 Nix 包管理器来安装几乎所有的软件包。
如果你有先前的 Linux 经验,它也相对容易理解。总而言之,**Nix 包管理器令人印象深刻**
#### 5. 使用同一软件包的多个版本
#### 5使用同一软件包的多个版本
这对开发者来说可能是至关重要的,有些应用需要特定依赖的旧版本,而有些则需要最新的版本。
而且,正如我前面提到的,nix将包安装到一个特定的子目录中,每个包都是隔离的,所以一个包不会干扰另一个包!
而且,正如我前面提到的,Nix 将包安装到一个特定的子目录中,每个包都是隔离的,所以一个包不会干扰另一个包
在使用 Nix 之前,我使用虚拟机和容器来满足同一软件包的不同依赖性,尤其是 PHP但 NixOS 为我的工作流程带来了奇迹。
#### 6. 无需安装就能测试软件包的能力
#### 6无需安装就能测试软件包的能力
你可以使用 [nix-shell][9],它将临时修改 $PATH 环境变量,用来临时测试一个包。
你可以使用 [nix-shell][9],它通过临时修改 `$PATH` 环境变量来测试一个包。
而且没有任何限制。你被允许测试每一个可供安装的软件包!
而且没有任何限制。你能够测试每一个可供安装的软件包!
### NixOS 系列:让我们探索更多!
这是我们 Nix 系列的第一部分,我介绍了使用 NixOS 的原因。我相信更多的 Linux 用户应该去了解它,如果他们还没有了解的话。
在下一部分,我将解释如何在你的虚拟机中安装 NixOS。敬请关注我们的社交媒体或 RSS 订阅,以便在我们发布时阅读。
在下一部分,我将解释如何在你的虚拟机中安装 NixOS。
💬 _欢迎在下面的评论中分享关于 NixOS 的其他内容的建议。_
💬 欢迎在下面的评论中分享关于 NixOS 的其他内容的建议。
--------------------------------------------------------------------------------
@ -131,7 +133,7 @@ via: https://itsfoss.com/why-use-nixos/
作者:[Sagar Sharma][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/) 荣誉推出
@ -142,4 +144,5 @@ via: https://itsfoss.com/why-use-nixos/
[3]: https://itsfoss.com/content/images/2023/02/nix-os-gnome.png
[4]: https://itsfoss.com/content/images/2023/02/nix-os-generations.png
[5]: https://linuxhandbook.com/symbolic-link-linux/
[9]: https://nixos.org/manual/nix/stable/command-ref/nix-shell.html
[9]: https://nixos.org/manual/nix/stable/command-ref/nix-shell.html
[0]: https://img.linux.net.cn/data/attachment/album/202303/08/150044jhtdyahoax5ghbxn.jpg

View File

@ -0,0 +1,249 @@
[#]: subject: "NixOS Series #2: How to Install NixOS on a Virtual Machine?"
[#]: via: "https://itsfoss.com/install-nixos-vm/"
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15624-1.html"
NixOS 系列 #2:如何在虚拟机上安装 NixOS
======
如果你可以在任何 Linux 发行版上使用 Nix 包管理器,为什么还要安装 NixOS
在使用 NixOS 几天之前,我经常想知道同样的事情。
当我意识到这些好处后,我就写了这篇文章来帮助你了解 [为什么你要考虑使用 NixOS][1]。如果你已经阅读了本系列的第一篇文章,那么你已经知道自己想要什么了。
那么,如何开始呢?考虑到它对许多人来说可能是一种新体验,你应该用它替换日常使用的系统还是将其安装为虚拟机?
我建议在你想要将其替换为你的主要操作系统之前在虚拟机上使用 NixOS。这适用于你想尝试的任何新事物特别是 [先进的 Linux 发行版][2],例如 NixOS。
### 使用 VirtualBox 在 VM 中安装 NixOS
在本教程中,我将使用 VirtualBox。
如果你使用的是 Ubuntu 并且不关心是否拥有最新版本,那么可以使用一个命令安装 VirtualBox
```
sudo apt install virtualbox
```
想要安装最新版本?你可以参考下面的指南:
> **[如何在 Ubuntu 上安装 VirtualBox初学者教程][24]**
如果你使用 Ubuntu 以外的任何发行版,你可以 [按照其官方下载页面的下载说明进行操作][3]。
成功安装 VirtualBox 后,让我们从第一步开始。
#### 步骤 1获 取NixOS 的 ISO 镜像
你需要前往 NixOS [官方下载页面][4]。
在 “NixOS: the Linux distribution” 部分,你会找到带有 GNOME 和 KDE 桌面的 ISO。
当然,也有最小化 ISO但我建议使用两者之一GNOME 和 KDE
![下载 NixOS ISO 文件][5]
对于本教程,我将使用 GNOME。
请记住,你可以选择 GNOME 和 KDE 两种<ruby>立付桌面环境<rt>Live Desktop</rt></ruby>
而在安装过程中,你可以选择自己喜欢的桌面环境,包括 **Xfce、Pantheon、Cinnamon、MATE** 等等!
#### 步骤 2在 VirtualBox 中创建虚拟机
打开 VirtualBox 并单击 “<ruby>新建<rt>New</rt></ruby>” 按钮添加新的虚拟机:
![截图显示了如何点击新建按钮来添加新的虚拟机][6]
它将打开一个提示,要求你添加有关要添加的虚拟机的信息。
你可以先命名虚拟机:
- 为你的虚拟机命名,以便你可以识别它是 NixOS 系统。所以我将其命名为 “NixOS”。
- 选择你刚刚下载的 ISO 镜像。
- 选择 “Linux” ISO 类型。
- 并在版本选择 “<ruby>其它 Linux64 位)<rt>Other Linux (64-bit)</rt></ruby>”。
![][7]
选择所有内容后,单击 “<ruby>下一步<rt>Next</rt></ruby>” 按钮。
接下来系统会要求你选择基本内存RAM、要分配给此虚拟机的处理器以及存储空间。
虽然 NixOS 没有提到官方要求,但我建议你为此安装至少拥有 **4GB RAM**、**2-4 个处理器内核**和 **30GB 空间**
![选择 NixOS 虚拟机的硬件][8]
最后,它会显示你为此虚拟机所做选择的摘要:
![NixOS 虚拟机 安装摘要][9]
如果一切正常,请单击 “<ruby>完成<rt>Finish</rt></ruby>” 按钮,它将为你创建一个 NixOS 虚拟机。
#### 步骤 3安装 NixOS
创建完虚拟机后,你为 NixOS 虚拟机指定的名称应该显示在 VirtualBox 的虚拟机列表中。
选择 “NixOS” 虚拟机并单击“开始”按钮:
![开始 NixOS 虚拟机][10]
它将启动 NixOS <ruby>立付桌面环境<rt>Live Desktop</rt></ruby>,以便你可以试用 Linux 发行版。
##### 选择安装语言
启动进入 NixOS 后,安装程序将启动并要求你设置安装程序的首选语言:
![选择安装时的首选语言][11]
##### 选择地区和时区
接下来,选择你所在的地区和区域。如果你不知道这一点,你可以从地图上选择你的国家,它会为你设置。
选择区域和区域后,它还会选择系统的首选语言、数字和日期区域设置。
当然,你可以根据需要进行更改,但对于大多数用户而言,选定的选项就可以正常工作:
![选择地区和时区][12]
##### 选择键盘布局
接下来,你将必须设置键盘布局。对于大多数用户来说,默认设置的 “English (US)” 应该可以正常工作。
如果你要进行其他操作,则可以在继续之前测试你的键盘配置。
![选择键盘格式][13]
之后,系统会要求你创建一个用户并为该用户设置密码。
你可以选择为虚拟机保留一个强密码或任何随机密码。
![创建用户][14]
##### 选择你喜欢的桌面环境
使用 NixOS你可以选择以下桌面环境
- GNOME
- KDE定制的最佳选择
- Xfce
- PantheonElementaryOS 附带的桌面环境)
- Cinnamon
- Enlightenment
- LXQt
![选择桌面环境][15]
##### 在 NixOS 上使用非自由软件
NixOS 遵循与 Fedora 类似的方法,你必须选择是否需要非自由软件。
我建议你启用非自由包:
![启用非自由软件包][16]
##### 分区部分
由于这是一个虚拟机指南,我建议你使用自动对磁盘进行分区的 “<ruby>擦除磁盘<rt>Erase disk</rt></ruby>” 选项!
![自动分区][17]
完成后,它将为你提供你所做选择的摘要:
![安装选择摘要][18]
如果一切正常,请单击 “<ruby>安装<rt>Install</rt></ruby>” 按钮,它将开始安装。
##### 不要重启而是关闭虚拟机
安装完成后,你可以选择重新启动虚拟机。
如果你这样做,**它将再次加载安装程序**
要解决此问题,你必须更改引导顺序。
为此,请在安装完成后关闭虚拟机。
要关闭虚拟机,请从“<ruby>文件<rt>File</rt></ruby>”菜单中选择 “<ruby>关闭<rt>Close</rt></ruby>” 选项,然后选择 “<ruby>关闭虚拟机电源<rt>Power off the machine</rt></ruby>” 选项:
![][19]
##### 更改 VirtualBox 中的启动顺序
要更改 NixOS 虚拟机 中的启动顺序,请打开该虚拟机的设置:
![][20]
在设置中,选择 “<ruby>系统<rt>System</rt></ruby>”,你将找到启动顺序。
在这里,选择 “<ruby>硬盘<rt>Hard Disk</rt></ruby>” 并使用选项旁边的**向上箭头**图标并将其设为启动的第一个选项:
![改变启动顺序][21]
按下 “<ruby>确定<rt>OK</rt></ruby>”,它将保存你所做的更改。
**或者**你可以移除我们添加的用于启动安装的光盘ISO 镜像)。
#### 步骤 4从 NixOS 安装启动
现在,启动你的 NixOS 虚拟机,你将看到一个 GRUB 屏幕:
![NixOS grub][22]
选择默认选项,它将带你进入带有 GNOME 桌面的全新 NixOS 安装。
![运行 NixOS][23]
就是这些了!**请继续探索 NixOS**
### 总结
这是关于如何在 VirtualBox 上安装 NixOS 的快速指南。
对于 NixOS 教程系列的下一部分,我将分享有关**安装和删除包**的建议。
💬 _敬请期待本系列的下一部分。在那之前请随时分享你对 NixOS 的看法或在遵循指南时遇到任何问题_
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-nixos-vm/
作者:[Sagar Sharma][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sagar/
[b]: https://github.com/lkxed/
[1]: https://linux.cn/article-15606-1.html
[2]: https://itsfoss.com/advanced-linux-distros/
[3]: https://www.virtualbox.org/wiki/Linux_Downloads
[4]: https://nixos.org/download.html
[5]: https://itsfoss.com/content/images/2023/02/Download-NixOS-ISO-file.png
[6]: https://itsfoss.com/content/images/2023/02/click-on-new-to-add-new-virtual-machine.png
[7]: https://itsfoss.com/content/images/2023/02/Add-NixOS-ISO-to-VirtualBox.png
[8]: https://itsfoss.com/content/images/2023/02/select-hardware-for-NixOS-VM-1.png
[9]: https://itsfoss.com/content/images/2023/02/summery-of-NixOS-VM-install.png
[10]: https://itsfoss.com/content/images/2023/02/start-the-NixOS-VM.png
[11]: https://itsfoss.com/content/images/2023/02/1.-choose-the-language-of-NixOS-installer.png
[12]: https://itsfoss.com/content/images/2023/02/2.-choose-the-region-and-zone-for-NixOS.png
[13]: https://itsfoss.com/content/images/2023/02/3.-select-Keyboard-layout-for-NixOS.png
[14]: https://itsfoss.com/content/images/2023/02/4.-create-user-and-set-password-for-NixOS.png
[15]: https://itsfoss.com/content/images/2023/02/5.-choose-desktop-environment-for-NixOS.png
[16]: https://itsfoss.com/content/images/2023/02/6.-Allow-unfree-software.png
[17]: https://itsfoss.com/content/images/2023/02/7.-select-erase-disk-option-while-installing-NixOS.png
[18]: https://itsfoss.com/content/images/2023/02/8.-summery-of-NixOS-installation-options-in-VM.png
[19]: https://itsfoss.com/content/images/2023/02/poweroff-VM.png
[20]: https://itsfoss.com/content/images/2023/02/open-settings-for-VM-in-VirtualBox.png
[21]: https://itsfoss.com/content/images/2023/02/how-to-change-the-boot-order-in-VirtualBox.gif
[22]: https://itsfoss.com/content/images/2023/02/NixOS-grub-screen.png
[23]: https://itsfoss.com/content/images/2023/02/running-NixOS-in-VM.png
[24]: https://itsfoss.com/install-virtualbox-ubuntu/
[0]: https://img.linux.net.cn/data/attachment/album/202303/14/154007dt8ucpf8co9o9otf.jpg

View File

@ -0,0 +1,114 @@
[#]: subject: "How to Install IDLE Python IDE in Ubuntu and Other Linux"
[#]: via: "https://www.debugpoint.com/install-idle-ubuntu-linux/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15622-1.html"
如何在 Ubuntu 和其他 Linux 下安装 IDLE Python IDE
======
![][0]
> 在 Ubuntu 和其他发行版中Python 的默认 IDE IDLE 没有被默认安装。在本指南中了解如何安装它。
IDLE<ruby>集成开发学习环境<rt>**I**ntegrated **D**evelopment and **L**earning **E**nvironment</rt></ruby>)是一个 [Python IDE][1],由 Python 语言本身编写,在 Windows 中通常作为 [Python 安装][2] 的一部分而安装。它是初学者的理想选择,使用起来很简单。对于那些正在学习 Python 的人,比如学生,它可以作为一个很好的 IDE 来开始使用。
语法高亮、智能识别和自动补全等基本功能是这个 IDE 的一些特点。你可以随时在官方 [文档][3] 中了解更多关于 IDLE 的功能。
### Ubuntu 和其他 Linux 中的 IDLE
所有的 Linux 发行版,包括 Ubuntu都预装了 Python。即使你手动升级或安装了 Python 版本IDLE IDE 也不会自带安装。你必须手动安装它。
对于 **Debian、Ubuntu、Linux Mint 和相关发行版**,打开终端,运行以下命令来安装 IDLE
```
sudo apt update
```
```
sudo apt install idle3
```
当命令询问你是否要安装 IDLE 时,输入 `Yes`。命令完成后IDLE 将被安装在你的 Ubuntu 系统中。
对于 **Fedora、RHEL、CentOS**,使用下面的命令来安装它:
```
sudo dnf update
```
```
sudo dnf install idle3
```
**Arch Linux** 用户可以使用以下命令进行安装:
```
sudo pacman -S python tk
```
![IDLE 在 Ubuntu 的安装和运行][4]
### 启动 IDLE 并编写一个测试程序
在 Ubuntu、Debian、Linux Mint 和 Fedora 中安装后,你可以在应用菜单中找到 IDLE 的图标。见下图:
![应用菜单中的 IDLE 图标][5]
如果你使用的是 Arch Linux你需要在命令行中运行以下内容来启动 IDLE
```
idle
```
启动 IDLE 后,你应该看到主窗口,如下图所示:
![IDLE 编辑器主窗口][6]
默认情况下,它会显示一个 <ruby>交互界面<rt>Shell</rt></ruby>,你可以直接在每一行中执行 Python 代码。它的工作方式和任何 Shell 解释器一样。而当你点击回车键时,你会得到输出,还有三个 `>` 符号进入下一行,执行下一个命令。
![在 IDLE 中运行一个简单的 Python 语句][7]
IDLE 也允许你从它的文件菜单中打开任何 .py 文件。它将在一个单独的窗口中打开该文件,在那里你可以进行修改并直接运行它。你可以使用 `F5` 或者从选项 “<ruby>运行<rt>Run</rt></ruby> > <ruby>运行模块<rt>Run Module</rt></ruby>” 来运行。
![从 IDLE 中打开的一个 Python 文件][8]
![使用菜单运行该文件的选项][9]
输出会显示在一个单独的输出窗口中。在输出窗口中,你可以开始调试,进入一行或文件,查看堆栈跟踪和其他选项。
![输出显示在 IDLE 的一个单独的输出窗口中][10]
### 总结
现在你学会了如何在 Ubuntu 和其他发行版中安装 IDLE IDE以及如何运行一条语句或一个 Python 程序。对于初学者来说IDLE 是一个很好的起点,在进入更复杂的 IDE 之前,可以先掌握基础知识。
我希望这篇指南对你的 Python 之旅有所帮助。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/install-idle-ubuntu-linux/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/5-best-python-ide-code-editor/
[2]: https://www.debugpoint.com/install-python-windows/
[3]: https://docs.python.org/3/library/idle.html
[4]: https://www.debugpoint.com/wp-content/uploads/2023/02/IDLE-install-and-run-in-Ubuntu.jpg
[5]: https://www.debugpoint.com/wp-content/uploads/2023/02/IDLE-icon-in-the-application-menu.jpg
[6]: https://www.debugpoint.com/wp-content/uploads/2023/02/IDLE-editor-main-window.jpg
[7]: https://www.debugpoint.com/wp-content/uploads/2023/02/Running-a-simple-Python-statement-in-IDLE.jpg
[8]: https://www.debugpoint.com/wp-content/uploads/2023/02/A-python-file-opened-from-IDLE.jpg
[9]: https://www.debugpoint.com/wp-content/uploads/2023/02/Option-to-Run-the-file-using-menu.jpg
[10]: https://www.debugpoint.com/wp-content/uploads/2023/02/Output-is-shown-in-a-separate-output-window-of-IDLE.jpg
[0]: https://img.linux.net.cn/data/attachment/album/202303/12/232046d7j0203ilosu986r.jpg

View File

@ -3,28 +3,32 @@
[#]: author: "Elizabeth Garrett Christensen https://opensource.com/users/elizabethchristensencrunchydatacom"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15601-1.html"
管理大型 Postgres 数据库的 3 个技巧
======
![][0]
> 在处理庞大的数据库时,请尝试这些方便的解决方案,以解决常见的问题。
关系型数据库 PostgreSQL也被称为 Postgres已经越来越流行全球各地的企业和公共部门都在使用它。随着这种广泛的采用数据库已经变得比以前更大了。在 Crunchy Data我们经常与 20TB 以上的数据库打交道,而且我们现有的数据库还在继续增长。我的同事 David Christensen 和我收集了一些关于管理拥有巨大表的数据库的技巧。
### 大表
生产数据库通常由许多具有不同数据、大小和模式的表组成。常见的情况是,最终有一个巨大的、无序的数据库表,远远大于你数据库中的任何其他表。这个表经常存储活动日志或有时间戳的事件,对你的应用或用户来说是必要的。
生产数据库通常由许多具有不同数据、大小和模式的表组成。常见的情况是,最终有一个巨大的、无序的数据库表,远远大于你数据库中的任何其他表。这个表经常存储活动日志或有时间戳的事件,而且对你的应用或用户来说是必要的。
真正的大表会因为很多原因造成挑战,但一个常见的原因是锁。对表的定期维护往往需要锁,但对大表的锁可能会使你的应用瘫痪,或导致堵塞和许多令人头痛的问题。我有一些做基本维护的技巧,比如添加列或索引,同时避免长期运行的锁。
**添加索引的问题**:索引的创建会在创建过程中锁住表。如果你有一个庞大的表,这可能需要几个小时。
**添加索引的问题**在创建索引的过程中锁住表。如果你有一个庞大的表,这可能需要几个小时。
```
CREATE INDEX ON customers (last_name)
```
**方案**:使用 **CREATE INDEX CONCURRENTLY** 功能。这种方法将索引创建分成两部分,一部分是短暂的锁定,以创建索引,立即开始跟踪变化,但尽量减少应用阻塞,然后是完全建立索引,之后查询可以开始使用它。
**方案**:使用 `CREATE INDEX CONCURRENTLY` 功能。这种方法将索引创建分成两部分,一部分是短暂的锁定,以创建索引,立即开始跟踪变化,但尽量减少应用阻塞,然后是完全建立索引,之后查询可以开始使用它。
```
CREATE INDEX CONCURRENTLY ON customers (last_name)
@ -34,10 +38,9 @@ CREATE INDEX CONCURRENTLY ON customers (last_name)
在数据库的使用过程中,添加列是一个常见的请求,但是对于一个巨大的表来说,这可能是很棘手的,同样是由于锁的问题。
**问题**:当你添加一个新的默认列,并调用一个函数Postgres 需要重写表。对于大表,这可能需要几个小时。
**问题**:当你添加一个新的默认值为一个函数的列Postgres 需要重写表。对于大表,这可能需要几个小时。
**Solution**: Split up the operation into multiple steps with the total effect of the basic statement, but retain control of the timing of locks.
**方案**:将操作拆分为多条基本语句,总效果一致,但保留对锁的时间控制。
**方案**:将操作拆分为多条基本语句,总效果一致,但控制锁的时间。
添加列:
@ -48,12 +51,10 @@ ALTER TABLE all_my_exes ADD COLUMN location text
添加默认值:
```
ALTER TABLE all_my_exes ALTER COLUMN location
SET DEFAULT texas()
ALTER TABLE all_my_exes ALTER COLUMN location SET DEFAULT texas()
```
使用 **UPDATE** 来添加默认值:
使用 `UPDATE` 来添加默认值:
```
UPDATE all_my_exes SET location = DEFAULT
@ -64,11 +65,7 @@ UPDATE all_my_exes SET location = DEFAULT
**问题**: 你想添加一个用于数据验证的检查约束。但是如果你使用直接的方法来添加约束,它将锁定表,同时验证表中的所有现有数据。另外,如果在验证的任何时候出现错误,它将回滚。
```
ALTER TABLE favorite_bands
ADD CONSTRAINT name_check
CHECK (name = 'Led Zeppelin')
ALTER TABLE favorite_bands ADD CONSTRAINT name_check CHECK (name = 'Led Zeppelin')
```
**方案**:告诉 Postgres 这个约束,但不要验证它。在第二步中进行验证。这将在第一步中进行短暂的锁定,确保所有新的/修改过的行都符合约束条件,然后在另一步骤中进行验证,以确认所有现有的数据都通过约束条件。
@ -76,11 +73,7 @@ CHECK (name = 'Led Zeppelin')
告诉 Postgres 这个约束,但不要强制执行它:
```
ALTER TABLE favorite_bands
ADD CONSTRAINT name_check
CHECK (name = 'Led Zeppelin') NOT VALID
ALTER TABLE favorite_bands ADD CONSTRAINT name_check CHECK (name = 'Led Zeppelin') NOT VALID
```
然后在创建后**验证**它:
@ -100,9 +93,10 @@ via: https://opensource.com/article/23/2/manage-large-postgres-databases
作者:[Elizabeth Garrett Christensen][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/) 荣誉推出
[a]: https://opensource.com/users/elizabethchristensencrunchydatacom
[b]: https://github.com/lkxed/
[0]: https://img.linux.net.cn/data/attachment/album/202303/06/113049bkunsxun1clzuca8.jpg

View File

@ -0,0 +1,201 @@
[#]: subject: "How to Install PgAdmin4 on RHEL 9 Step by Step"
[#]: via: "https://www.linuxtechi.com/how-to-install-pgadmin-on-rhel/"
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15618-1.html"
如何在 RHEL 9 上分步安装 PgAdmin4
======
![][0]
PgAdmin4 是一个自由开源的基于网络的 PostgreSQL 管理和开发平台。它可以与本地或远程的服务器上的 PostgreSQL 数据库服务器进行交互,并使用直观的交互式仪表板显示服务器的统计数据。
PgAdmin4 是对 PgAdmin3 的重写,提供了以下显著的功能:
- 具有直观的实时监控仪表盘的响应式 Web UI。
- 改进的 Web 界面,具有很酷的新面板和图标。
- 带有语法高亮的 SQL 查询编辑器。
- 全面的文档。
- 帮助你入门的有用提示。
在本指南中,我们将演示如何在 RHEL 9 上安装 PgAdmin4。
### 先决条件
在开始之前,确保你有一台 RHEL 9 服务器实例并安装了 PostgreSQL 数据库。请查看如何在 RHEL 9 上 [安装 PostgreSQL 15][13] 的指南。
在安装了 PostgreSQL 服务器后,继续执行以下步骤。
### 步骤 1在 RHEL 9 上添加 PgAdmin4 仓库
第一步是在 RHEL 9 上添加 PgAdmin4 仓库。但首先要安装 EPEL 仓库,它提供了基本的软件包。
```
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
```
接下来,安装 PgAdmin4 仓库,如下所示:
```
$ sudo dnf install -y https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
```
完成后,为 PgAdmin4 和 EPEL 仓库建立一个缓存,如下所示:
```
$ sudo dnf makecache
```
### 步骤 2在 RHEL 9 上安装 PgAdmin4
安装好 PgAdmin4 和 EPEL 仓库后,继续使用 DNF 包管理器安装 PgAdmin4如下所示
```
$ sudo dnf install pgadmin4 -y
```
这将安装许多软件包,包括 PgAdmin4、Apache HTTP web 服务器和 Python 软件包,仅举几例:
![][1]
要确认 PgAdmin4 是否已经安装,请运行以下命令:
```
$ rpm -qi pgadmin4
```
这将打印出相当多的信息,包括已安装软件包的名称、版本、发行和架构。
![][2]
### 步骤 3在 RHEL 9 上启动/启用 PgAdmin4
此时PgAdmin4 已成功安装。然而,你需要更进一步,让它运行起来。要启动 PgAdmin4 服务,请运行以下命令:
```
$ sudo systemctl start httpd
```
还要确保每次系统启动时都能启动该服务。
```
$ sudo systemctl enable httpd
```
要确认 PgAdmin4 正在运行,请执行以下命令:
```
$ sudo systemctl status httpd
```
![][3]
### 步骤 4在 RHEL 9 上初始化 PgAdmin4
PgAdmin4 软件包提供了一个可配置的脚本来设置 PgAdmin 网络服务。这允许你创建一个用户账户,用来验证和配置 SELinux 策略和 Apache Web 服务器。
因此,如下运行该脚本:
```
$ sudo /usr/pgadmin4/bin/setup-web.sh
```
提供你将在登录页面上作为登录凭证使用的电子邮件和密码。
注意:有时,你可能会遇到如下 “semanage: command not found” 的错误。这表明缺少 `semanage` 包。
![][4]
Semanage 是 SELinux安全增强型 Linux策略管理工具的简称是一个用于配置 SELinux 策略某些方面的工具,不需要对策略源进行修改或重新编译。
为了解决这个错误,你需要检查提供 `semanage` 的软件包。你可以通过运行以下命令来完成:
```
$ sudo dnf provides /usr/sbin/semanage
```
从输出中,你可以看到 `semanage` 是由 `policycoreutils-python-utils-3.3-6.el9_0.noarch` 包提供的。
![][5]
要安装这个软件包,请运行以下命令:
```
$ sudo dnf install policycoreutils-python-utils -y
```
再一次如下运行 Pgadmin4 安装脚本。 提供电子邮件地址和密码,在提示时输入 `y`
```
$ sudo /usr/pgadmin4/bin/setup-web.sh
```
![][6]
### 步骤 5访问 PgAdmin4 的 Web 界面
此时PgAdmin4 已经成功安装。要从网络浏览器访问它,请前往以下地址:
```
http://server-ip/pgadmin4
```
你会看到登录网页界面。请确保提供你在运行安装脚本时提供的 Email 和密码,并点击 “<ruby>登录<rt>Login</rt></ruby>”:
![][7]
登录后PgAdmin4 的仪表板将出现在视图中,如图所示:
![][8]
要添加一个可以由 PgAdmin4 管理的服务器,请点击 “<ruby>添加新服务器<rt>Add New Server</rt></ruby>”:
![][9]
在 “<ruby>通用<rt>General</rt></ruby>” 选项卡中,填写服务器的名称,并添加注释,以便更好地描述:
![][10]
接下来,点击 “<ruby>连接<rt>Connection</rt></ruby>”,填写主机名/地址、端口、维护数据库、用户名和密码。然后最后点击 “<ruby>保存<rt>Save</rt></ruby>”:
![][11]
此后,你会看到 PosrgreSQL 服务器的统计数据显示在互动和直观的仪表板上。在左边的侧边栏,你可以浏览各种 PostgreSQL 参数:
![][12]
### 总结
我们希望你觉得本指南内容丰富,请在下面的评论部分发表你的疑问和反馈。
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/how-to-install-pgadmin-on-rhel/
作者:[Pradeep Kumar][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lkxed/
[1]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Install-pgadmin4-rhel9-dnf-command.png
[2]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Pgadmin4-RPM-Package-Information-RHEL9.png
[3]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Start-Enable-Http-Pgadmin-RHEL9.png
[4]: https://www.linuxtechi.com/wp-content/uploads/2023/03/semange-not-found-pgadmin4-rhel9.png
[5]: https://www.linuxtechi.com/wp-content/uploads/2023/03/DNF-Whatprovides-semanage-RHEL9.png
[6]: https://www.linuxtechi.com/wp-content/uploads/2023/03/pgadmin-setup-web-script-rhel9.png
[7]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Pgadmin4-Login-Page-RHEL9.png
[8]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Dashboard-Pgadmin4-RHEL9.png
[9]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Add-New-PostgreSQL-to-Pgadmin4-RHEL9.png
[10]: https://www.linuxtechi.com/wp-content/uploads/2023/03/General-Description-Pgadmin-New-PostgreSQL.png
[11]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Connection-Details-PostgreSQL-Pgadmin4-GUI.png
[12]: https://www.linuxtechi.com/wp-content/uploads/2023/03/PostgreSQL-Statistics-Dashboard-Pgadmin4.png
[13]: https://www.linuxtechi.com/how-to-install-postgresql-on-rhel/
[0]: https://img.linux.net.cn/data/attachment/album/202303/12/080937o03a11xsz99zawzm.jpg

View File

@ -0,0 +1,124 @@
[#]: subject: "Use your Raspberry Pi as a streaming server"
[#]: via: "https://opensource.com/article/23/3/raspberry-pi-streaming-server"
[#]: author: "Sven Erbeck https://opensource.com/users/erbeck"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15616-1.html"
将你的树莓派用作流媒体服务器
======
![][0]
> 用树莓派串流网络摄像头的实时视频,并将视频重新串流到社交网络。
出于各种原因,人们需要流式传输网络摄像头的实时视频。树莓派平台很适合此类应用。对于实时流媒体服务器等连续应用,它只需要很少的电力。可以与 Raspicam 相机模块、USB 摄像头或其他网络视频信号进行通信。该系统是一个 RTMP、HLS 和 SRT 服务器。这篇文章展示了如何将树莓派设置为流媒体服务器以使用 HLS 流媒体。你需要一个视频源才能把它作为流媒体服务器使用。
即使没有树莓派,你也可以完成这里描述的步骤。此外,还有针对 [Windows][1]、[Linux][2] 和 [macOS][3] 的进一步安装说明。
### 设置
该应用程序是 datarhei [Restreamer][4],是 datarhei [Core][5] 的图形用户界面。datarhei Core 在底层运行著名的媒体框架 FFmpeg。开始使用 datarhei Restreamer 的最简单方法是安装官方的 Docker 容器。通过 Docker Hub 的程序下载和安装是通过 ` docker pull` 命令自动进行的。安装后Restreamer 立即启动。如果你没有树莓派,可以使用 datarhei [Restreamer GitHub][4] 页面上的其他 Docker 容器之一(例如,支持 AMD64 或 GPU Cuda
datarhei Restreamer 和 datarhei Core 都是 [Apache 许可证 2.0][6] 下的开源软件。
以下是在支持 GPU 的树莓派 3 及以上机型上的安装命令:
```
docker run -d --restart=always --name restreamer \
-v /opt/restreamer/config:/core/config -v /opt/restreamer/data:/core/data \
--privileged \
-p 8080:8080 -p 8181:8181 \
-p 1935:1935 -p 1936:1936 \
-p 6000:6000/udp \
datarhei/restreamer:rpi-latest
```
无论你使用哪条命令,你只需要 `--privileged` 选项来访问本地设备,如 USB 摄像头。
安装后,将 Raspberry Pi 连接到本地网络。然后在浏览器中进入 [http://device-ip:8181/ui][7] 打开基于 Web 的 GUI。
你应该看到以下屏幕:
![First login into datarhei Restreamer][8]
分配好密码,系统就可以进行首次登录了。向导正在开始配置第一个视频源。
提示:上述 Docker 命令将带有登录名和密码的配置数据永久保存在 `/opt/restreamer/config` 文件夹中。
### 实施
该应用程序由三个逻辑部分组成:视频输入、系统仪表板和视频输出。视频输入和输出相互独立运行。
### 视频输入
该向导将帮助你从头开始创建一个视频源。这可以是一个 USB 视频源、树莓派摄像头,或者是一个网络源,如 IP 摄像头或来自网络的 m3u8 文件。HLS、RTMP 和实时 SRT 协议都可以使用。该向导可以帮助正确配置视频分辨率和声音。在最后一步,你可以分配不同 <ruby>知识共享<rt>Creative Commons</rt></ruby> 许可证。值得看一下视频信号的设置。你会发现几个选项,例如为垂直视频平台转码或旋转视频。
### 仪表板
成功创建视频信号后,你将进入仪表板。
![datarhei Restreamer dashboard][9]
它是所有其他设置的中心起点。要看到程序的全部功能,你可以在系统偏好中切换到专家模式。
仪表板包含以下内容:
- 视频信号设置。
- RTMP、SRT、HLS 服务器和快照的活动内容 URL。
- 用于重新流式传输的所有活动发布服务。
- 启动向导来创建额外的视频源。
- 系统菜单。
- 实时视频信号统计。
- 实时系统监控。
### 视频输出
有不同的方法来播放视频信号。
这个 [发布网站][10] 是 Restreamer 最简单、即时可用且内部托管的登录页面。播放页面也可以传输到 Chromecast 和 AirPlay。调整背景图片和在播放器中添加标识等基本设置可以直接在 Restreamer 中进行。那些懂 HTML 的人可以为自己定制页面。高级用户可以注入代码,以使用网站的外部模块,如聊天。视频播放器下的统计模块显示活跃的观众和所有视图。“<ruby>分享<rt>Share</rt></ruby>” 按钮支持直播流的分发。网站的 HTTPS 证书通过 Let's Encrypt 激活,无需太多努力。通过简单的 HTTPS 端口转发到树莓派的 LAN IP网站就可以公开访问。
![Landingpage from datahrei Restreamer][11]
发布服务是重新传输内容的一个好方法。对于流行的网站,如 YouTube、Twitch 或 PeerTube有许多现成的模块。同样对于其他流媒体软件、流行的 CDN 也是如此。对视频协议的完全控制允许流式传输到所有支持 RTMP、HLS 和 SRT 的目标地址。一个带有视频播放器的 HTML 片段代码在网页上工作。
![Presets for publication services][12]
### 使用树莓派播放流媒体节省电力
这篇文章展示了如何将树莓派变成一个流媒体服务器。树莓派平台允许你以省电的方式与各种视频信号互动。预先的设置使配置服务器变得很容易,高级用户可以对系统进行一些调整。你可以用它来做回放,在网站上托管实时流式传输,或使用 [OBS][13] 集成到系统环境中。使用不同的视频源和传输协议作为项目的基础,提供了极大的灵活性,使这个系统具有高度的可定制性。此外,带有 FFmpeg 的 datarhei Core 使软件开发者很容易扩展所有的应用进程。
该程序将树莓派变成一个专门的流媒体服务器。你可以独立地直播到网站或多路直播到不同的视频网络,而无需额外的视频提供商。
可以使用登录名 “admin” 和密码 “demo” 在项目网站上安装之前测试功能齐全的 [演示][14]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/raspberry-pi-streaming-server
作者:[Sven Erbeck][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/erbeck
[b]: https://github.com/lkxed/
[1]: https://docs.datarhei.com/restreamer/installing/windows
[2]: https://docs.datarhei.com/restreamer/installing/linux
[3]: https://docs.datarhei.com/restreamer/installing/mac
[4]: https://github.com/datarhei/restreamer
[5]: https://github.com/datarhei/core
[6]: https://github.com/datarhei/restreamer/blob/2.x/LICENSE
[7]: http://device-ip:8181/ui
[8]: https://opensource.com/sites/default/files/2023-01/fig2-first-login-datarhei.jpg
[9]: https://opensource.com/sites/default/files/2023-01/fig1-title-dashboard-datarhei.jpg
[10]: https://demo.datarhei.com/
[11]: https://opensource.com/sites/default/files/2023-01/fig3-int-publication-website-datarhei.jpg
[12]: https://opensource.com/sites/default/files/2023-01/fig4-preset-publication-services-datarhei.jpg
[13]: https://opensource.com/article/20/6/obs-websockets-streaming
[14]: https://demo.datarhei.com/ui
[0]: https://img.linux.net.cn/data/attachment/album/202303/11/101802ajd68nnzn6788h6i.jpg

View File

@ -0,0 +1,71 @@
[#]: subject: "Parallel and distributed computing with Raspberry Pi clusters"
[#]: via: "https://opensource.com/article/23/3/parallel-distributed-computing-raspberry-pi-clusters"
[#]: author: "Peter Cheer https://opensource.com/users/visimpscot2"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15609-1.html"
用树莓派集群进行并行和分布式计算
======
![][0]
> 这个使用树莓派集群的学术实验向远程教育学生介绍了并行和分布式计算PDC的概念。
自从树莓派推出以来,创造者们已经在这个简陋的袖珍芯片系统上开展了无数的计算机科学教育项目。其中包括许多探索低成本树莓派集群的项目,以介绍 <ruby>并行和分布式计算<rt>Parallel and Distributed Computing</rt></ruby>PDC概念。
英国 <ruby>开放大学<rt>Open University</rt></ruby>OU为不同年龄、经历和背景的学生提供远程教育这就提出了一些在更传统的大学中没有面临的问题。开放大学使用树莓派集群向远程教育学生介绍 PDC 概念的实验始于 2019 年,并在一篇 [学术论文][1] 中进行了介绍,但值得更广泛地了解。
该项目使用基于 [OctaPi 教程][2] 的树莓派集群,该指令由 GCHQ 在知识共享许可协议下发布。八个树莓派使用一个路由器和一个交换机连接在一个私人网络中。其中一个树莓派充当主控,而其他的是服务器,将结果反馈给主控设备。用 Python 编写的程序运行在主控树莓派,而 `dispy` 包将活动分发在集群的各个处理核心上。
他们为该集群开发了三个程序,你可以从 [Git 仓库][3] 下载它们。
其中两个程序是基于文本的,并与搜索问题有关:旅行推销员和密码散列。作为完整的搜索问题,这些是教授 PDC 概念的理想选择。第三个程序是图形化的。图像组合器将三幅图像作为输入,其中有不重叠的障碍物。它通过对三幅图像的 RGBA 值进行逐个像素的比较并选择中位数来构建一个没有任何障碍物的图像。
### 使用集群
开放大学是一个远程学习机构,所以学生通过网页界面访问集群。对集群的远程访问使用大学的 OpenSTEM 实验室的基础设施。10 个集群8 个用树莓派 4 构建2 个用树莓派 3B+ 建造)被安装在机架上,用网络摄像头对准每个集群。
学生们选择要运行的程序,使用的核心数量,以及所选程序的参数。作为输出,他们可以看到该程序在单个树莓派上运行的时间与使用所选核数的集群的时间相比。学生还可以看到程序的输出,如密码散列结果、最小和最大的旅行推销员路线,或未遮挡的图像。
![Generating a fourth image from information in three images][4]
网络摄像头显示了集群的实时流。主控树莓派有一个 LED 显示屏,显示程序运行时的状态。网络摄像头让学生清楚地知道,他们是在用真正的专用硬件做实验,而不是得到模拟的或预先录制的结果。
![Raspberry Pi cluster][5]
每个程序都有两个与之相关的活动,描述了程序设计和 PDC 操作的不同方面。其中一个主要的学习点是PDC 计算可以提供显著的性能优势,但代价是划分和分发问题以及反过来重新组合结果所花费的时间和资源。第二个学习点是,效率受程序设计的影响很大。
### 学生喜欢
目前,树莓派集群的使用是可选的。不过根据目前的研究结果,学生们很喜欢它,并因能远程接触到物理硬件而受到激励。
一位学生说:“能够使用真正的集群,而不是让它虚拟化,这真的很有趣”。
另一名学生补充说:“能够真正看到集群的工作,看到多核工作的真实效果,这真的很令人兴奋。能够亲自尝试,而不仅仅是阅读有关理论,这真是太好了!”
学生们正在使用集群开展旨在教授 PDC 原理的学习活动,而不是编写和运行他们自己的程序。开发低成本的树莓派集群供远程大学学生使用的经验表明,远程实践活动对教授 PDC 概念和吸引学生有好处。
当我向该项目背后的团队成员之一 Daniel Gooch 询问时,他说:“对我来说,我们的不同之处在于,我们采用了一套现有的树莓派教程,并致力于整合更多外围材料,以确保它能够应对我们操作的距离和规模。”
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/parallel-distributed-computing-raspberry-pi-clusters
作者:[Peter Cheer][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/visimpscot2
[b]: https://github.com/lkxed/
[1]: https://doi.org/10.1080/02680513.2022.2118573
[2]: https://projects.raspberrypi.org/en/projects/build-an-octapi
[3]: https://github.com/dg7692/TM129
[4]: https://opensource.com/sites/default/files/2023-02/image-project.png
[5]: https://opensource.com/sites/default/files/2023-02/cluster.png
[0]: https://img.linux.net.cn/data/attachment/album/202303/09/103012m05dzitda8581bcj.jpg

View File

@ -0,0 +1,55 @@
[#]: subject: "A trivia vending machine made with a Raspberry Pi"
[#]: via: "https://opensource.com/article/23/3/raspberry-pi-trivia-vending-machine"
[#]: author: "Phil Shapiro https://opensource.com/users/pshapiro"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15652-1.html"
用树莓派制作的问答售货机
======
![][0]
> 用树莓派取代食品售货机上的投币箱是一个天才之举。
作为在公共图书馆工作的教育工作者,我一直在关注 [树莓派][1] 的有趣用途。在我看来,得克萨斯州达拉斯市的<ruby>问答售货机<rt>Trivia Vending Machine</rt></ruby>项目是这些神奇设备最具创意和最有趣的用途之一。使用树莓派取代食品售货机上的投币箱是 Greg Needel 和他的团队的一个天才之作。这个想法的潜在用途是深远的。请观看下面这个 [YouTube 短视频][2],了解问答自动售货机的运行情况。
![YouTube 短视频][2]
最初的问答售货机专注于科学问题,但你可以制作一个问答售货机来回答任何问题:历史、公民、文学等等。如果你鼓励学生写自己的问题,并回答对方的问题,那将是最有吸引力的用途。请考虑这样:自动售货机可以不发放食物,而是发放当地企业的优惠券。我谋生的方式之一是教吉他课,我很乐意捐出一节吉他课作为问答售货机的优惠券。然而,学生必须积累适当数量的积分才能获得我的一堂吉他课。
把你的想象力再延伸一点。是否有可能让学生解决逻辑谜题,以便从自动售货机获得食物(或优惠券)?是的,这并不难创造。也许是数独谜题、[Wordle][3]、KenKen、Sokoban 或任何其他谜题。学生可以用触摸屏玩这些谜题。国际象棋怎么样?当然,学生可以通过解决象棋谜题来获得食物(或优惠券)。
你是否注意到视频中原来的问答售货机又大又重? 设计一个更小的,可能是滚动手推车大小的三分之一,这可以在学校、图书馆、博物馆和创客嘉年华之间更容易运输。
问答售货机的内部由步进电机组成。你可以在网上购买二手的。在网络上搜索“二手自动售货机电机”会出现 [Vending World][4] 和 [VendMedic][5] 网站。
如果你是创客空间的成员请向其他成员介绍问答售货机。这是一个开放的发明没有专利所以任何人都可以制造它。谢谢你Greg Needel我想为这样的设备编写代码并不太难。如果有人可以创建此类代码的 GitHub 仓库,以及可能附带的一些解释性截屏,那就太好了。
虽然问答售货机没有在红牛创意大赛中获奖,但这项发明还是值得获奖的。应该有人找到 Greg Needel 并给他一个合适的奖品。该奖项应该是什么样子的?可能是 2.5 万或 5 万美金的样子。我为 Greg Needel 和他的创意团队欢呼三声。他们把树莓派带到了这种计算机的发明者所希望的方向:修理工的快乐。大胆、美丽、开放。你还能要求更多吗?
最后一件事。问答售货机是几年前使用早期的树莓派型号制作的。当前的树莓派速度更快,响应更快。因此,你在上述视频中注意到的任何交互延迟在今天的树莓派上已不复存在。
哦,我非常想要一块糖果。我砸吧砸吧嘴。提醒我,我需要赚取多少积分才能获得士力架?不惜一切代价,我会不惜一切代价。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/raspberry-pi-trivia-vending-machine
作者:[Phil Shapiro][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/pshapiro
[b]: https://github.com/lkxed/
[1]: https://opensource.com/resources/raspberry-pi
[2]: https://www.youtube.com/watch?v=pDOhk-YAhys
[3]: https://opensource.com/article/22/1/word-game-linux-command-line
[4]: https://vendingworld.com/small-vending-parts/vending-machine-motors-small-parts
[5]: https://www.vendmedic.com/product-category/vending-parts/vend-motors/
[0]: https://img.linux.net.cn/data/attachment/album/202303/22/214542uba6m8d8dwbahraa.jpg

View File

@ -0,0 +1,99 @@
[#]: subject: "How I automate graphics creation with Inkscape"
[#]: via: "https://opensource.com/article/23/3/automate-graphics-production-inkscape"
[#]: author: "Máirín Duffy https://opensource.com/users/mairin"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15610-1.html"
我如何用 Inkscape 实现图形创作自动化
======
![][0]
> 跟随这个 Inkscape 教程,大量创建会议讲座卡图形。
我录制了一个 [15 分钟长的教程][1],演示如何在 [Inkscape][2] 中从 CSV 文件或电子表格中自动生成图形(基本上是邮件合并类图形)。它使用了 Maren Hachmann 的 [Next Generator Inkscape 扩展][3]。
你可以在 [Fedora 设计团队在 Linux Rocks 上的 PeerTube 频道][4]PeerTube 是开源的!)或下面的嵌入式 YouTube 视频中观看。
![][4a]
在这篇文章中,我提供了一些关于这个教程相关的背景。我还包括了对视频中内容的一个非常简要的总结,以防你宁愿草草浏览文字而不看视频。
### 会议讲座卡图形
每个 Flock/Nest 都需要为你在举办虚拟会议的在线平台上的每个讲座提供一个图形。像这样的大型活动,通常有大约 50 个或更多的讲座。这需要大量手工制作的图形。
通过本教程,你将学习如何在 Inkscape 中制作这样的模板。
![图片显示 Inkscape 模板的一个例子][5]
CSV 文件类似这样:
| CONFERENCENAME | TALKNAME | PRESENTERNAMES |
| :- | :- | :- |
| BestCon | The Pandas Are Marching | Beefy D. Miracle |
| Fedora Nest | Why Fedora is the Best Linux | Colúr and Badger |
| BambooFest 2022 | Bamboo Tastes Better with Fedora | Panda |
| AwesomeCon | The Best Talk You Ever Heard | Dr. Ver E. Awesome |
将它们结合起来CSV 中的每一行生成一个图形,像这样:
![在 Inkscape 模板上显示 CSV 的图片][6]
会议图形是你如何应用这个教程的一个好例子。你也可以用它来生成名片(它输出的是 PDF、个性化的生日邀请函、教室里学生的个性化图形比如贴在学生课桌上的名卡以及办公室的铭牌。你也可以用它来创建用于标记物品的图形。[作为 Fedora 设计团队的成员][7],你甚至可以用它来为 Fedora 制作很棒的横幅和图片!你可以用它来制作大量的不同用途。你可以应用这种技术的用途有很多,所以让你的想象力飞翔吧。
### Inkscape Next Generator 扩展
创建这些图片的第一步是安装 Maren Hachmann 为Inkscape 创建的 [Next Generator 扩展][3]。
- 到网站上下载 [next_gen.inx][8] 和 [next_gen.py][9]。
- 然后进入 Inkscape的 “<ruby>编辑<rt>Edit</rt></ruby> > <ruby>首选项<rt>Preferences</rt></ruby> > <ruby>系统<rt>System</rt></ruby>”对话框。搜索 “<ruby>用户扩展<rt>User Extensions</rt></ruby>” 目录列表并点击 “<ruby>打开<rt>Open</rt></ruby>” 图标。将 .inx 和 .py 文件拖入该文件夹。
- 最后,你应该关闭所有打开的 Inkscape 窗口并重新启动 Inkscape。新的扩展在 “<ruby>扩展<rt>Extensions</rt></ruby>” 菜单下: “<ruby>扩展<rt>Extensions</rt></ruby> > <ruby>输出<rt>Export</rt></ruby> > Next Generator”。
### 创建一个模板
你的 CSV 文件的每个标题(在我的例子中:`ConferenceName`、`TalkName`、`PresenterNames`)都是一个变量,你可以把它放在 Inkscape 文件中,作为你的模板。[看一下 SVG 模板文件的例子][10],以获得指导。如果你想让 `TalkName` 出现在你的模板中,在 Inkscape中创建一个文本对象并将以下内容放入其中
```
%VAR_TalkName%
```
当你运行扩展时,`%VAR_TalkName%` 文本将被替换为 CSV 中每一行列出的 `TalkName`。因此,对于第一行,`%VAR_TalkName%` 被替换为第一个图形的文本 `The Pandas Are Marching`。对于第二个图形,`TalkName` 是 `Why Fedora is the Best Linux`。继续,直到给每个图形的加上 `TalkName` 列。
### 运行生成器
一旦你的模板准备好了,通过加载你的 CSV运行 `Next Generator` 扩展。然后,选择你想在每个文件名中使用的变量(标题名称),点击 “<ruby>应用<rt>Apply</rt></ruby>” 按钮。
在后面的文章中,我将提供一个关于这个扩展的更高级使用的教程,比如改变每个文件中包含的颜色和图形。
本文最初发表在作者的 [博客][11]上,经许可后重新发表。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/automate-graphics-production-inkscape
作者:[Máirín Duffy][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mairin
[b]: https://github.com/lkxed/
[1]: https://peertube.linuxrocks.online/w/sf8Vqgg3aRkPKpb7KMsHgH
[2]: http://inkscape.org
[3]: https://gitlab.com/Moini/nextgenerator
[4]: https://peertube.linuxrocks.online/c/fedora_design/videos
[4a]: https://youtu.be/IxZC4gNwFyM
[5]: https://opensource.com/sites/default/files/2023-02/InkscapeTemplateExample.png
[6]: https://opensource.com/sites/default/files/2023-02/Bamboo-Tastes-Better-with-FedoraINKSCAPE.png
[7]: https://matrix.to/#/#design:fedoraproject.org
[8]: https://gitlab.com/Moini/nextgenerator/-/raw/master/next_gen.inx?inline=false
[9]: https://gitlab.com/Moini/nextgenerator/-/raw/master/next_gen.py?inline=false
[10]: https://gitlab.com/fedora/design/team/tutorials/inkscape-automation/-/blob/main/template-simple.svg
[11]: https://blog.linuxgrrl.com/2022/07/19/how-to-automate-graphics-production-with-inkscape/
[0]: https://img.linux.net.cn/data/attachment/album/202303/09/113944o6m8mdqmgmq1ey8y.jpg

View File

@ -0,0 +1,160 @@
[#]: subject: "Install DOSBox in Ubuntu to Play Retro Games"
[#]: via: "https://itsfoss.com/ubuntu-dosbox/"
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "Cubik65536"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15619-1.html"
在 Ubuntu 中安装 DOSBox 来玩复古游戏
======
![][0]
DOSBox 是一款自由开源的软件,它可以让你模拟上个世纪的 MS-DOS 操作系统。
你为什么要这么做呢?因为怀旧:它可以让你游玩在 80 年代和 90 年代流行的 8 位游戏。
这其中包含了马里奥、魂斗罗、DOOM 等传奇游戏。
听起来不错吧?让我介绍一下如何在 Ubuntu 中安装 DOSBox。我还会向你展示如何在 DOSBox 中安装并游玩复古游戏。
DOSBox 也可以在其他 Linux 发行版中使用。除了安装部分,其余的指令应该对所有发行版都有效。
> ✋🏻 DOS 是一个主要基于命令行的操作系统。使用 DOSbox 需要使用终端。
### 在 Ubuntu 中安装 DOSBox
DOSBox 包可以在 [Universe 软件仓库][1] 中找到。这个仓库应该已经被启用了,所以可以使用下面的命令来安装 DOSBox
```
sudo apt install dosbox
```
完成之后,从系统菜单中启动 DOSBox。
或者,你也可以使用终端来启动 DOSBox
```
dosbox
```
**需要首先运行一次,因为它会为我们创建一个配置文件。实际上,第一次启动时不需要做任何事情,因为它会创建配置文件。**
然后在 DOSBox 终端中执行 `exit` 命令来关闭 DOSBox
```
exit
```
![][2]
如果你想要调整配置,配置文件位于 `~/.dosbox/dosbox-[版本].conf`
在这个配置文件中,你可以调整几乎所有的东西,比如在启动 DOSBox 时进入全屏模式,更改核心等等。
但是(对我来说)启用全屏模式会使事情变得更糟,并且必须重新登录才能进入默认模式:
![DOSBox 全屏模式错误][3]
**所以,除非你知道你在做什么,否则不要修改配置。**
### 在 DOSBox 中安装游戏
你可以从互联网档案馆的软件库中访问数百款流行游戏。
> **[从互联网档案馆下载游戏][4]**
每款游戏都有自己的 zip 文件,其中包含 .exe 文件。下载你喜欢的游戏。
然后,在你的主目录中[创建一个新目录][5],命名为 `dosbox`,并为你下载的游戏创建目录:
```
mkdir ~/dosbox && cd ~/dosbox
mkdir [游戏名称]
```
我下载了马里奥。你可以给目录起任何名字。这里没什么要求,只是为了管理游戏而已。
![在 Linux 中创建目录][6]
然后,将 `.zip` 文件解压到你刚刚创建的 `dosbox` 目录中:
![解压文件到 dosbox 目录][7]
如果你想的话,你也可以在终端中 [使用 unzip 命令][8] 来做同样的事情:
```
unzip ~/Downloads/MARIO.zip -d ~/dosbox/mario/
```
当你完成之后,启动 DOSBox
```
dosbox
```
然后,将游戏挂载到虚拟 C 驱动器上:
```
mount c ~/dosbox/mario
```
![将游戏挂载到虚拟 C 驱动器上][9]
然后,切换到虚拟 C 驱动器:
```
c:
```
![切换到虚拟 C 驱动器][10]
最后,通过输入游戏的文件名来启动游戏:
```
mario
```
然后,享受游戏吧。
![在 Ubuntu 中玩马里奥][11]
### 想要更多复古的东西?
如果你有不再使用的旧电脑或者树莓派,你可以把它们变成复古游戏机。有很多 Linux 项目就是为了这个目的而存在的。
> **[把你的电脑变成复古游戏机的 Linux 发行版](https://itsfoss.com/retro-gaming-console-linux-distros/)**
为什么只玩游戏呢?你也可以把复古的计算机终端带回来。
> **[用 Cool Retro Terminal 获得一个复古的 Linux 终端](https://itsfoss.com/cool-retro-term/)**
希望该指南对你有所帮助。你是如何在 Linux 上玩游戏的?在评论中告诉我吧。
--------------------------------------------------------------------------------
via: https://itsfoss.com/ubuntu-dosbox/
作者:[Sagar Sharma][a]
选题:[lkxed][b]
译者:[Cubik65536](https://github.com/Cubik65536)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sagar/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/ubuntu-repositories/
[2]: https://itsfoss.com/content/images/2023/02/run-DOSBox-on-ubuntu.png
[3]: https://itsfoss.com/content/images/2023/02/full-screen-error-on-DOSBox.png
[4]: https://archive.org/details/softwarelibrary_msdos_games?tab=collection&ref=its-foss
[5]: https://itsfoss.com/make-directories/
[6]: https://itsfoss.com/content/images/2023/02/create-a-directory-in-linux--1.png
[7]: https://itsfoss.com/content/images/2023/02/extract-file-to-the-dosbox-directory-1.png
[8]: https://learnubuntu.com/unzip-file/?ref=its-foss
[9]: https://itsfoss.com/content/images/2023/02/mount-the-game-to-the-virtual-C-drive.png
[10]: https://itsfoss.com/content/images/2023/02/switch-to-the-virtual-drive-C.png
[11]: https://itsfoss.com/content/images/2023/02/play-mario-on-Linux.gif
[0]: https://img.linux.net.cn/data/attachment/album/202303/12/091038c81kxkmhdonj1mkm.jpg

View File

@ -0,0 +1,111 @@
[#]: subject: "Xubuntu Minimal: Opportunity to Build Your Own Distro"
[#]: via: "https://www.debugpoint.com/xubuntu-minimal/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15613-1.html"
精简版 Xubuntu建立你自己的发行版的机会
======
> Xubuntu 团队从 23.04 版本开始推出了一个包含少量组件的精简 ISO。以下是它的情况。
![][1]
几天前Canonical [宣布][2]Ubuntu 23.04 “Lunar Lobster” 版本官方的精简 ISO 安装文件正在制作中。虽然截至发稿时,该镜像还没有出现,但 Xubuntu 团队设法推出了他们自己的精简 ISO 安装镜像。
Xubuntu 被数百万人使用,并且一直是许多其他发行版的基础。对于一些用户来说,默认安装可能带有太多的预装包和功能,导致系统臃肿,计算机性能降低。这就是 Xubuntu 精简安装发挥作用的地方。在这篇文章中,我们将采取实践的方式来安装和探索精简版 Ubuntu 的功能。
让我们看看你在 Xubuntu 精简安装中得到了什么,以及与普通桌面安装程序的比较。
### Xubuntu 精简安装
第一个明显的区别是精简安装与标准桌面安装程序的 ISO 镜像大小。它的大小大约减少了 39%。
| | 精简版 | 标准版 |
| - | - | - |
| 桌面安装程序ISO大小 | 1.7 GB | 2.8 GB |
在使用精简版安装程序安装 Xubuntu 时,你不会在 Ubiquity 中看到“<ruby>精简安装<rt>minimal install</rt></ruby>”的选项。其余的安装步骤都是一样的,没有区别。
然而,主要的区别是在安装的系统上。最小安装只需要 7.2GB 的磁盘空间,而同一版本的标准安装则需要 11GB。
| | 精简版 | 标准版 |
| - | - | - |
| 磁盘使用空间 | 7.2 GB | 11 GB |
因为许多应用程序被剥离了。
![Xubuntu 精简和标准安装比较][3]
在 Xubuntu 的精简安装中,你会得到以下东西:
- 终端
- 文件管理器
- 所有的设置应用
- Synaptic 包管理器
- 屏幕截图应用
就这些了。
如果你把它与标准版相比,你就不会有以下的应用:
- Firefox 浏览器
- Thunderbird 邮件客户端
- 媒体播放器(音频和视频)
- LibreOffice 套件
- Transmission Torrent 客户端
- GNOME 软件
- 游戏
- Gigolo 远程连接客户端
- 磁盘使用工具
### 精简版 Xubuntu 上的 Snap 包
令我惊讶的是,精简版 Xubuntu 没有安装 Snap甚至连 Snap 守护程序都没有。而且也没有 Flatpak。
所以,实际上你得到的是一个没有 Snap 的 Xubuntu 系统,但有一个核心的 Ubuntu 基础。
![看,没有 Snap][4]
但我不确定主 Ubuntu 的精简 ISO 会有同样的情况。我想我们需要等待和观察。
### 接下来是什么?
所以,现在你有了一个初级的 Xubuntu 桌面。使用 Synaptic 包管理器,你可以开始构建和安装你喜欢的应用。
例如,你可以 [设置 Flatpak][5] 并从一个基本的浏览器、媒体播放器、LibreOffice 等开始。
如果你是一个开发者,你可以安装 Visual Studio Code 或一些 IDE。
以这个版本为基础,你可以为你的工作流程建立任何发行版。
### 总结
Xubuntu 精简安装对于那些想要完全控制他们系统上安装的东西,并且喜欢更快、更有效的基于 Ubuntu 的发行版的用户来说是一个很好的选择。
Xfce 的可定制性、轻量级特性和使用 synaptic 的包管理使它成为任何定制构建的理想选择。
你可以从这个 [页面][6] 下载精简版 ISO。记住它还没有正式发布而且是一个日常构建的副本。所以使用它要**谨慎**。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/xubuntu-minimal/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/wp-content/uploads/2023/03/xubuntu1.jpg
[2]: https://linux.cn/article-15588-1.html
[3]: https://www.debugpoint.com/wp-content/uploads/2023/03/Xubuntu-minimal-and-standard-install-comparison.jpg
[4]: https://www.debugpoint.com/wp-content/uploads/2023/03/Look-no-snap.jpg
[5]: https://www.debugpoint.com/how-to-install-flatpak-apps-ubuntu-linux/
[6]: https://cdimage.ubuntu.com/xubuntu/daily-live/current/

View File

@ -0,0 +1,81 @@
[#]: subject: "How Wikipedia helps keep the internet open"
[#]: via: "https://opensource.com/article/23/3/how-wikipedia-helps-keep-internet-open"
[#]: author: "Srishti Sethi https://opensource.com/users/srishakatux-0"
[#]: collector: "lkxed"
[#]: translator: "onionstalgia"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15637-1.html"
维基百科是如何帮助保持互联网的开放性的
======
![][0]
> 维基百科体现了互联网最初愿景的精神,而你也可以成为其中的一部分。
维基百科是最有意义的开源软件项目之一,原因之一是它远比你想象的庞大。而且,任何人都可以贡献内容,并且任何人都可以为项目背后的许多技术领域贡献代码,确保维基百科正常运行。
[超过 870 个维基百科及其附属网站][1] 提供了多语言版本,它们服务于一个共同目标,“开发自由的教育内容,并有效地在全球范围内传播”。例如,<ruby>维基共享资源<rt>Wikimedia Commons</rt></ruby> 是一个自由的媒体文件库,截至今天,它已经拥有超过 6800 万张图片。<ruby>维基文库<rt>Wikisource</rt></ruby> 是一个自由的文本资源库,拥有超过 500 万篇文章和 72 种语言的活跃网站子域名。<ruby>维基数据<rt>Wikidata</rt></ruby> 是一个可访问的数据存储库,包含被 [多个与维基百科相关的网站][2] 所使用的超过 9900 万个数据项。
这些项目由 <ruby>维基媒体基金会<rt>Wikimedia Foundation</rt></ruby> 支持和维护,它是一个总部位于旧金山的非营利组织。基金会使全球数十万名志愿者为项目的自由知识作出贡献。在这个知识收集和生产的社区背后,有着大量的维护、技术支持和管理工作,以保持网站的正常运转。当然,从外部来看,你可能仍然好奇,开发维基百科的软件还需要做哪些工作。毕竟,它可是世界上最受欢迎的十大网站之一,致力于提供最好的信息。
事实上,每篇维基百科的文章都借助了成千上万的软件工具来创建、编辑和维护。这些步骤,确保了你在世界任何地方都能获得公平可靠快速的信息。当你浏览维基百科或任何其他维基网站时,你是在与一个称之为 [MediaWiki][3] 的软件交互,这是一个强大的团队协作文档软件,用以支持维基百科的内容。它有一些默认特性,而为了进一步增强软件的功能,你可以安装各种扩展。数不胜数的扩展中,最著名的两个是:
- VisualEditor一种适用于 MediaWiki 驱动的维基站点的 <ruby>所见即所得<rt>WYSIWYG</rt></ruby> 富文本编辑器。
- Wikibase用于存储、管理和访问维基百科从 <ruby>维基数据<rt>Wikidata</rt></ruby> 上拉取的结构化数据。
所有这些优秀的辅助工具使现代维基百科愈发完善并正常运行,每一个都至关重要。
### 维基百科和 MediaWiki
总体来说维基百科的技术生态是非常庞大的MediaWiki 是维基媒体世界中最受欢迎的软件之一遵循开源代码许可已经有超过四十万个项目和组织使用它来托管内容。例如NASA 使用它来组织有关太空任务的内容和知识库!
此外还有许多其他机器人、工具、桌面和移动应用可以帮助用户访问、创建、编辑和维护内容。例如机器人可以自动化重复繁琐的任务可以用来对抗恶意破坏、向新手推荐文章、进行文章事实核查等这大大减轻了编辑的工作负担。InternetArchiveBot 也是个十分流行的机器人,常用于与 <ruby>网站时光机<rt>Wayback Machine</rt></ruby> 通信,修复维基百科上的死链。
上文中的 “工具”,指的是支持贡献者们工作的软件。比如,组织者可以使用这些 “工具” 开展 <ruby>编辑松<rt>editathons</rt></ruby>、举办各种活动、开设维基百科编辑教育课程等。截至 2022 年 5 月,机器人和工具的贡献占 870 个维基媒体编辑总量中的 36.6%,足以证明它们在整个生态中举足轻重。
Kiwix 是一款知名的离线阅读器桌面应用,它可以在网络连接有限的区域,特别是教育场所中提供对维基百科的访问。维基百科和维基共享资源的移动应用,也允许编辑者通过他们的移动设备贡献文章和媒体文件,这使我们的知识平台更加普及化,能够面向全球更广泛的受众。
下次当你浏览维基百科时,发现了文章在近期发生相关事件后有频繁的实时更改,你就能更好地想象屏幕后在发生什么啦。
### 维基百科的技术社区
维基百科启动于 2001 年,当时仅有约十名开发人员。自从 2003 年维基媒体基金会成立以来,开发人员的数量在近年里大幅增长。现在,约有一千名开发人员正在为知识运动中的各种项目做出贡献。这个数字每年都会波动,这取决于活跃贡献者和工作人员的数量、支持志愿开发人员的计划、以及全球性事件(如大流行)等因素。
技术社区的成员以各种方式和角色做出贡献。比如代码贡献者、文档编写、设计师、倡导者、导师、社区组织者、测试人员、翻译人员、网站管理员等。
根据一项关于新开发者的调查,维基媒体和其他开源项目一样,吸引了许多来自美国、欧洲和印度的贡献者,在世界各地不断壮大。
志愿开发者和维基百科编辑者有类似的动机。他们成为贡献者,是来支持自由知识事业、学习和获得新技能、改善其他编辑者的体验等等。来自印度的一位志愿开发者说:“我最初其实是作为编辑者加入的,但我还是着手摸索维基百科背后的技术,因为印地语维基百科社区中,能够通过技术手段解决我们当地语言需求的贡献者实在太少了。”
在 2021 年 7 月至 2022 年 6 月期间,仅考虑托管在维基媒体 Gerrit 实例中的代码仓库514 名开发人员在 1225 个存储库中进行了 45,621 次合并改动。这些贡献中48.52% 来自维基媒体基金会之外的其他组织和 [独立开发人员][7]。其中一些开发人员还是不同地区的用户组、分会和附属机构的成员,致力于推广使用维基媒体项目和鼓励贡献。这些数字还不包括选择在外部托管代码的额外开发人员,或直接托管在维基页面上的代码,例如小工具或模块。
### 有所作为
维基百科是一个可供所有人使用的庞大知识库。在许多方面,它体现了互联网的最初愿景:作为信息、理解和协作的来源。
你可以作为贡献者成为维基百科的一份子,无论是通过在文章中分享你的知识,还是通过帮助构建使其所有工作成为可能的软件。如果你有兴趣加入维基媒体的技术社区,请浏览我们的开发者网站上的资源,并学习如何 [参与其中][8]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/how-wikipedia-helps-keep-internet-open
作者:[Srishti Sethi][a]
选题:[lkxed][b]
译者:[onionstalgia](https://github.com/onionstalgia)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/srishakatux-0
[b]: https://github.com/lkxed/
[1]: https://wikimediafoundation.org/our-work/wikimedia-projects/#a1-reference
[2]: https://meta.wikimedia.org/wiki/Wikimedia_wikis
[3]: https://www.mediawiki.org/wiki/MediaWiki
[4]: https://wikistats.wmcloud.org/
[5]: https://wikimediafoundation.org/news/2016/05/05/mediawiki-nasa/
[6]: https://meta.wikimedia.org/wiki/Kiwix
[7]: https://wikimedia.biterg.io/
[8]: https://developer.wikimedia.org/
[0]: https://img.linux.net.cn/data/attachment/album/202303/17/094522xwmr76zb7hwnlfxy.jpg

View File

@ -0,0 +1,301 @@
[#]: subject: "NixOS Series #3: Install and Remove Packages in NixOS"
[#]: via: "https://itsfoss.com/nixos-package-management/"
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15645-1.html"
NixOS 系列 #3:在 NixOS 中安装和删除软件包
======
NixOS 中的打包系统是它最强大的地方。Nix 软件包管理器使用的语法与 `apt`、`dnf` 和其他软件包管理器大不相同。
这也是 [人们应该尝试使用 NixOS 的原因之一][1]。
在本指南中,我将分享两种在 NixOS 上安装和删除软件包的方法:
- 使用 Nix 软件包管理器
- 使用 `configuration.nix` 配置文件
> ⚠️ 使用 Nix 软件包管理器,你只能安装软件包,而不能安装 OpenSSH 或 Plex 服务器等服务。对于服务的安装,你必须使用 Nix 配置文件。
要安装任何软件包,必须知道它的确切名称,为此,我将从如何在 NixOS 中搜索软件包开始。
### 搜索软件包
要寻找软件包,你可以使用它的 [网页搜索][2]。
你可以使用如下步骤:
- 在搜索栏中输入软件包的名称
- 选择适当的软件包(从给出的描述中决定)
- 点击 “nix-env” 标签页
- 复制 NixOS 命令(第一条)
例如,如果我想要 `librewolf` 包,我将执行以下操作:
![使用 Nix 软件包管理器的网络搜索寻找软件包][3]
你也可以通过终端做同样的事情。
要使用终端搜索软件包,你可以按照给定的命令语法进行:
```
nix-env -qaP --description [软件包名称]
```
例如,在这里,我搜索了 `librewolf`
![使用终端搜索 NixOS 中的软件包][4]
你必须复制输出的第一行,因为那是你需要安装的软件包的名称。
在这里它是 `nixos.librewolf`
是的,它听起来可能没有像使用 [APT][5] 或 DNF 时软件包名字那么方便。但是,我认为这并不是大问题。
一些妥协或许会换来一些好处?
### 在 NixOS 中安装一个软件包
要安装一个软件包,你所要做的就是使用以下命令语法:
```
nix-env -iA [软件包名称]
```
而且,如果你使用网络搜索来寻找软件包,你就已经有了安装所需的确切命令。
所以,假设我想安装 `librewolf',我将使用以下命令:
```
nix-env -iA nixos.librewolf
```
如果你想进行全系统的安装(让每个用户都能使用这个包),用 `sudo` 执行安装命令:
```
sudo nix-env -iA nixos.librewolf
```
就是这样!你将很快安装好你喜欢的软件包。
### 在 NixOS 中卸载一个软件包
要删除一个软件包,你可以参考下面的命令语法:
```
nix-env --uninstall [软件包名称]
```
因此,如果我必须删除 `librewolf` 包,我必须使用以下命令:
```
nix-env --uninstall librewolf
```
如果你仔细注意,我使用了 `librewolf` 而不是 `nixos.librewolf` 来安装。
这意味着你在删除软件包时要跳过 `nixos` 部分,这使事情变得简单而快速。
### 在 NixOS 中安装服务
正如我前面提到的,你不能使用 Nix 软件包管理器来安装像 OpenSSH、Plex 服务器、[Flatpak][6] 等服务。
从搜索服务到安装过程,都与你上面看到的不同。
所以让我先说说如何 **搜索服务**
- 要搜索服务,请前往 Nix 软件包搜索 [网页][2]
- 选择 “<ruby>NixOS 选项<rt>NixOS options</rt></ruby>”(页面顶部菜单行的第三个选项)
- 输入你要找的服务的名称
- 复制服务的名称
例如,在这里,我正在搜索 OpenSSH 服务。
![搜索 NixOS 中的 OpenSSH 服务][7]
一旦你找到了这个名字,用下面的命令打开 `configuration.nix` 文件:
```
sudo nano /etc/nixos/configuration.nix
```
并在行末添加服务的名称(在 `}` 之前),如下:
```
[service_name] = true;
```
由于 **我想启用 OpenSSH**,我将添加以下内容:
```
services.openssh.enable = true;
```
![在 NixOS 上启用 OpenSSH][8]
一旦你在配置文件中添加了服务,[保存修改并退出 Nano][9] 文本编辑器。
要启用该服务,请重建配置文件,并使用以下命令切换到所做的更改:
```
sudo nixos-rebuild switch
```
这就行了,你已经启用了该服务。
### 从 NixOS 卸载服务
要卸载一个服务,你所要做的就是在 `configuration.nix` 文件中删除或注释该服务的一行。
因此,首先,用以下命令打开配置文件:
```
sudo nano /etc/nixos/configuration.nix
```
寻找服务,并删除这一行或用 `#` 注释掉:
![从 NixOS 删除服务][10]
通过添加注释 `#`,我忽略了 OpenSSH 服务的加载,因为我不再需要它在我的系统上。
保存修改并退出文本编辑器。
最后,重建配置文件并进行切换:
```
sudo nixos-rebuild switch
```
### 使用 Nix 配置文件安装软件包
配置文件可以让你 **方便地一次性管理软件包**
要使用 Nix 配置文件安装软件包,你必须在配置文件中输入软件包的名称、重建,然后切换到配置文件,就可以了。
首先,打开 `configuration.nix` 文件。
```
sudo nano /etc/nixos/configuration.nix
```
如果你想 **为一个特定的登录用户安装软件包**,将软件包的名称添加到用户的配置文件中。
用户配置文件看起来像这样:
```
users.users.sagar = {
isNormalUser = true;
description = "Sagar";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
];
};
```
当然,它将显示你的用户名而不是 `sagar`
你应该使用如下语法来添加软件包的名称:
```
packages = with pkgs; [
软件包名称
];
```
所以我们假设我也想安装 `Thunderbird`,那么我将添加它的名字,如下所示:
![使用 Nix 配置文件在 NixOS 中安装一个包][11]
你必须在方括号内添加所有的软件包名称,不要用逗号。它必须像截图中描述的那样一个软件一个新的行。
但是如果你想在整个系统中安装这个包,那么你必须在 `environment.systemPackages` 下添加包的名字,比如:
```
environment.systemPackages = with pkgs; [
软件包名称
];
```
![使用 Nix 配置文件在 NixOS 中全系统安装软件包][12]
一旦你完成了在系统配置文件或用户配置文件,甚至两者中添加所需软件包的名称,你将需要按照同样的命令来完成安装:
```
sudo nixos-rebuild switch
```
这样就可以了!
### 使用 Nix 配置文件删除软件包
要删除软件包,你所要做的就是按照给定的简单步骤进行:
- 打开 Nix 配置文件
- 删除或注释掉软件包的名称
- 重新构建配置并进行切换
所以,让我们从第一步开始(打开配置文件):
```
sudo nano /etc/nixos/configuration.nix
```
接下来,注释掉用户配置文件或系统配置文件中的包的名称:
![在 NixOS 上使用 Nix 配置文件删除包][13]
保存更改并退出配置文件。
最后,重建配置文件,并做一个切换来删除包:
```
sudo nixos-rebuild switch
```
这是这样!
> 📋 目前,还没有官方的 GUI 工具来帮助你安装/删除软件包。你可能会发现一些由社区开发的项目,如 [nix-gui][14] 和 [nix42b][15],但它们不再被维护或仅仅处于早期开发阶段。
### 接下来...
我希望你喜欢阅读 NixOS 系列,就像我写它一样。
在下一篇中,我将强调一些在你安装 NixOS 后需要马上做的重要事情。
如果你认为我遗漏了什么或有其他建议,请在评论中告诉我。
--------------------------------------------------------------------------------
via: https://itsfoss.com/nixos-package-management/
作者:[Sagar Sharma][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sagar/
[b]: https://github.com/lkxed/
[1]: https://linux.cn/article-15606-1.html
[2]: https://search.nixos.org/packages?ref=its-foss
[3]: https://itsfoss.com/content/images/2023/02/search-packages-for-nixos-1.png
[4]: https://itsfoss.com/content/images/2023/02/search-packages-in-nixos.png
[5]: https://itsfoss.com/apt-command-guide/
[6]: https://itsfoss.com/what-is-flatpak/
[7]: https://itsfoss.com/content/images/2023/02/Search-the-service-for-nixos-1.png
[8]: https://itsfoss.com/content/images/2023/02/enable-openssh-on-NixOS.png
[9]: https://linuxhandbook.com/nano-save-exit/?ref=its-foss
[10]: https://itsfoss.com/content/images/2023/02/remove-service-from-NixOS.png
[11]: https://itsfoss.com/content/images/2023/02/install-a-package-in-NixOS-using-the-Nix-config-file.png
[12]: https://itsfoss.com/content/images/2023/02/install-package-systemwide-in-NixOS-using-Nix-configuration-file-1.png
[13]: https://itsfoss.com/content/images/2023/02/remove-package-using-nix-config-file-on-NixOS.png
[14]: https://github.com/nix-gui/nix-gui?ref=its-foss
[15]: https://gitlab.com/juliendehos/nix42b?ref=its-foss
[0]: https://img.linux.net.cn/data/attachment/album/202303/21/090913cnq91ob2hn9b2qbh.jpg

View File

@ -0,0 +1,95 @@
[#]: subject: "Switch from iCloud to Nextcloud"
[#]: via: "https://opensource.com/article/23/3/switch-icloud-nextcloud"
[#]: author: "Heike Jurzik https://opensource.com/users/hej"
[#]: collector: "lkxed"
[#]: translator: "XiaotingHuang22"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15628-1.html"
把你的网盘从 iCloud 换成 Nextcloud
======
![][0]
> Nextcloud 是你自己的开源云。这里是如何进行转换的方法。
如果你对把数据提交给公司控制的云服务持谨慎态度,但同时又喜欢远程存储的便利性和基于 Web 的轻松访问,那么不止你是这样。云端因其广泛的功能而广受欢迎。但是 [云端服务不一定是封闭的][1]。幸运的是,开源项目 Nextcloud 提供了个人和私有的云应用程序套件。
[安装][2] 和导入数据很容易 —— 包括通讯录、日历和照片。真正难办的是从 iCloud 等云提供商那里获取数据。在本文中,我将告诉你把自己的数据迁移到 Nextcloud 需要采取的步骤。
### 把你的数据迁移至 Nextcloud
和在 [安卓设备][3] 上一样,首先你必须将现有数据从苹果的 iCloud 传输到 Nextcloud。然后你可以为你的苹果设备设置两个新帐户以完全自动同步通讯录和预约。苹果支持用于日历同步的 CalDAV 和用于通讯录同步的 CardDAV 开放协议,因此你甚至不需要安装额外的应用。
要导出你的通讯录,你可以在 iPhone 或者 iPad 上打开 “<ruby>通讯录<rt>Contacts</rt></ruby>” 应用或在网络浏览器中登录 iCloud
- 选择要传输到 Nextcloud 的所有地址簿条目,然后选择 “<ruby>文件<rt>File</rt></ruby> > <ruby>输出<rt>Export</rt></ruby> > <ruby>输出 vCard<rt>Export vCard</rt></ruby>” 以在本地磁盘上保存 .`vcf` 文件。
- 将 .`vcf` 文件导入 Nextcloud。为此请选择 “<ruby>通讯录<rt>Contacts</rt></ruby>” 应用,点击左下角的 “<ruby>设置<rt>Settings</rt></ruby>” 并选择 “<ruby>导入通讯录<rt>Import contacts</rt></ruby>” 按钮。 在接下来的对话窗口中,点击 “<ruby>选择本地文件<rt>Select local file</rt></ruby>”,然后打开之前保存的 vCard。
要在你的 iPhone 或 iPad 上设置 CardDAV 帐户,请转至 “<ruby>设置<rt>Settings</rt></ruby> > <ruby>通讯录<rt>Contacts</rt></ruby> > <ruby>帐户<rt>Accounts</rt></ruby> > <ruby>添加帐户<rt>Add Account</rt></ruby>”:
- 选择 “<ruby>其他<rt>Other</rt></ruby>”,然后选择 “添加 CardDAV 帐户”。 在 “<ruby>服务器<rt>Server</rt></ruby>” 字段中,输入 Nextcloud 的 URL例如`https://nextcloudpi.local`)。 下面是 Nextcloud 帐户的用户名和密码。 打开新帐户的 “<ruby>高级设置<rt>Advanced Settings</rt></ruby>”。
- 确保启用了 “<ruby>使用 SSL<rt>Use SSL</rt></ruby>” 选项。帐户 URL 通常设置正确。其中包含你的 Nextcloud 的主机名和你的用户名。
要在 macOS 上创建用于同步地址簿的新帐户,请打开 “<ruby>通讯录<rt>Contacts</rt></ruby>” 应用程序并从 “<ruby>通讯录<rt>Contacts</rt></ruby>” 菜单中选择 “<ruby>添加帐户<rt>Add Account</rt></ruby>”。 激活复选框 “<ruby>其他通讯录账号<rt>Other Contacts Account</rt></ruby>” 并单击 “<ruby>继续<rt>Continue</rt></ruby>”。你可以接受 “CardDAV” 条目。 在 “<ruby>账户类型<rt>Account Type</rt></ruby>” 下拉菜单中,选择 “<ruby>手动<rt>Manual</rt></ruby>” 输入。
![ Nextcloud 中高级设置的图片][5]
输入你的 Nextcloud 用户名、密码和服务器地址。当前的 macOS 版本要求你在服务器地址中指定端口 443用于 SSL。例如如果你的 Nextcloud 地址是 `https://nextcloudpi.local`,用户名是 `hej`,则在栏中输入以下内容:
```
https://nextcloudpi.local:443/remote.php/dav/principals/users/hej
```
### 同步你的日历
导出日历的方法类似,通过日历应用程序,你可以在浏览器、智能手机/平板电脑或 macOS 桌面上使用 iCloud 执行此操作。
首先,将日历设置为 “<ruby>公共<rt>public</rt></ruby>”。 这并不意味着每个人都可以访问你的日历。它仅用于生成日历订阅的链接。将 URL 复制到剪贴板。目前还无法将日历直接导入 Nextcloud因为你不是用一个链接而是用 .ics 文件iCalendar来导入。 以下是如何从链接生成这样的文件:
- 将链接复制到剪贴板
- 将链接粘贴到网络浏览器的地址栏中
- 更改 URL 的开头并将 `webcal` 替换为 `http`
- 按回车键并将 `.ics` 文件保存到你的磁盘上
![一张图片显示如何将 .ics 文件保存到磁盘上][8]
现在可以导入 .ics 文件了。 先在 Nextcloud 中打开 “<ruby>日历<rt>Calendar</rt></ruby>” 应用程序,单击左下方的 “<ruby>日历设置<rt>Calendar settings</rt></ruby>”,然后单击 “<ruby>导入日历<rt>Import calendar</rt></ruby>”。 选择你保存在文件管理器中的 `.ics` 文件。
对所有 iCloud 日历重复此过程。之后,就该更换旧的 iCloud 同步服务了。
### 同步事件
要与 Nextcloud 同步新事件,请在你的客户端设备(智能手机、平板电脑、台式机)上设置一个新帐户:
- iPhone/iPad<ruby>设置<rt>Settings</rt></ruby> / <ruby>日历<rt>Calendar</rt></ruby> / <ruby>账户<rt>Accounts</rt></ruby> / <ruby>添加账户<rt>Add Account</rt></ruby>,选择 “<ruby>其他<rt>Other</rt></ruby>”,然后选择 “<ruby>添加 CalDAV 账户<rt>Add CalDAV Account</rt></ruby>”。 在 “<ruby>服务器<rt>Server</rt></ruby>” 栏中,输入你的本地 Nextcloud URL`https://nextcloudpi.local`。 你可以看到 Nextcloud 帐户的用户名和密码输入的位置。
- macOS打开日历应用程序并从 “<ruby>日历<rt>Calendar</rt></ruby>” 菜单中选择 “<ruby>添加账户<rt>Add Account</rt></ruby>”。 激活复选框 “<ruby>其他 CalDAV 账户<rt>Other CalDAV Account</rt></ruby>” 并单击 “<ruby>继续<rt>Continue</rt></ruby>”。 从 “<ruby>账户类型<rt>Account Type</rt></ruby>” 下拉菜单中,选择 “<ruby>手动<rt>Manual</rt></ruby>” 输入。 输入你的 Nextcloud 用户名和密码以及 Nextcloud 服务器地址。不要忘记在服务器地址中指定端口 443用于 SSL 否则帐户设置将失败。
**提示:** 除了你的通讯录和日历,如果你想同步其他文件,如文档、照片、视频等,你可以安装苹果应用商店中提供 Nextcloud 应用程序。
本文改编自 Heike Jurzik 的《[树莓派上的 Nextcloud][9]》 一书。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/switch-icloud-nextcloud
作者:[Heike Jurzik][a]
选题:[lkxed][b]
译者:[XiaotingHuang22](https://github.com/XiaotingHuang22)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/hej
[b]: https://github.com/lkxed/
[1]: https://opensource.com/article/20/10/keep-cloud-open
[2]: https://opensource.com/article/21/1/nextcloud-productivity
[3]: https://opensource.com/article/23/3/switch-google-nextcloud
[4]: https://nextcloudpi.local/
[5]: https://opensource.com/sites/default/files/2023-02/advancedSettings-Nextcloud.png
[6]: https://nextcloudpi.local
[7]: https://nextcloudpi.local:443/remote.php/dav/principals/users/hej
[8]: https://opensource.com/sites/default/files/2023-02/NextcloudSaveIcsfile.png
[9]: https://www.amazon.de/-/en/gp/product/B0BTPZH8WT/ref=dbs_a_def_rwt_bibl_vppi_i4
[0]: https://img.linux.net.cn/data/attachment/album/202303/15/153049hmrhhbax9mmsr7h3.jpg

View File

@ -0,0 +1,134 @@
[#]: subject: "Terminal Basics Series #4: Creating Files in Linux"
[#]: via: "https://itsfoss.com/create-files/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15643-1.html"
终端基础:在 Linux 中创建文件
======
![][0]
到目前为止,在这个终端基础系列中,你已经学会了:
- [更改目录][1]
- [创建新目录][2]
- [列出目录内容][3]
现在让我们学习如何在 Linux 命令行中创建文件。我将简要讨论向文件添加内容。但是,稍后将介绍有关编辑文本文件的详细信息。
### 使用 touch 命令创建一个新的空文件
使用 `touch` 命令非常简单。
```
touch filename
```
切换到你的主目录并创建一个名为 `practice_files` 的新目录,然后切换到该目录:
```
mkdir practice_files && cd practice_files
```
> 💡 `&&` 是一种组合两个命令的方法。只有当第一个命令执行成功时,第二个命令才会运行。
现在,创建一个名为 `new_file` 的新文件:
```
touch new_file
```
就是这样。你刚刚创建了一个新的空文件。
列出目录内容并使用 `ls -l` 命令检查文件的属性。
![Using touch command to create new files][4]
> 💡 `touch` 命令的最初目的是“触摸”文件并更改其时间戳。如果提供的文件不存在,它会创建一个具有该名称的新文件。
### 使用 echo 命令创建一个新文件
很久以前我就应该向你介绍 `echo` 命令。迟到总比不到好。`echo` 命令显示你提供给它的任何内容。因此得名“回声”。
```
echo Hello World
```
你可以使用重定向并将输出路由到文件。因此在此过程中创建一个新文件:
```
echo "Hello World" >> other_new_file
```
这样,你将创建一个名为 `other_new_file` 的新文件,其中包含文本 `Hello World`
![Using echo command to create new file][5]
请记住,如果提供的文件已经存在,使用 `>>` 重定向,你将向文件添加一个新行。你也可以使用 `>` 重定向,但它会替换文件的现有内容。
更多关于重定向的信息可以在下面的教程中找到。
> **[解释Linux 中的输入、输出和错误重定向][7]**
### 使用 cat 命令创建新文件
`cat` 命令的最初目的是连接文件。但是,它主要用于显示文件的内容。
它还可以使用选项创建新文件并添加内容。为此,你可以使用相同的 `>``>>` 重定向。
```
cat >> another_file
```
但是这个将创建一个新文件并允许你向其中添加一些文本。添加文本是可选的。**你可以使用 `Ctrl+d` 键退出 `cat` 输入模式。**
![Using cat command to create new file][6]
同样,附加模式 `>>` 在文件内容的末尾添加新文本,而覆盖模式 `>` 用新内容替换现有内容。
> 🖥️ 使用 `ls -l` 长列表显示并注意时间戳。现在 `touch` 文件:
```
touch other_new_file
```
你看到时间戳的区别了吗?
### 测试你的知识
你已经了解了如何创建新文件。这里有一些简单的练习来练习你刚刚学到的东西。它也包括前几章的一些内容。
- 使用 `touch` 命令创建三个新文件,分别命名为 `file1`、`file2` 和 `file3`。提示:你不需要运行 `touch` 三次。
- 创建一个名为 `files` 的目录,并在其中创建一个名为 `my_file` 的文件。
- 使用 `cat` 命令创建一个名为 `your_file` 的文件,并在其中添加以下文本 “This is your file”。
- 使用 `echo` 命令将新行 “This is our file” 添加到 `your_file`
- 以相反的时间顺序显示所有文件(请参阅第 3 篇)。现在使用 `touch` 命令修改 `file2``file3` 的时间戳。现在再次按时间倒序显示内容。
这很有趣。你正在取得很好的进步。你已在本章中学会了创建新文件。接下来,你将学习如何查看文件的内容。
--------------------------------------------------------------------------------
via: https://itsfoss.com/create-files/
作者:[Abhishek Prakash][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/change-directories/
[2]: https://itsfoss.com/make-directories/
[3]: https://itsfoss.com/list-directory-content/
[4]: https://itsfoss.com/content/images/2023/03/touch-example.svg
[5]: https://itsfoss.com/content/images/2023/03/echo-example.svg
[6]: https://itsfoss.com/content/images/2023/03/cat-example.svg
[7]: https://linuxhandbook.com/redirection-linux/?ref=its-foss
[0]: https://img.linux.net.cn/data/attachment/album/202303/20/161045uuejvexqrfrurkwn.jpg

View File

@ -0,0 +1,85 @@
[#]: subject: "Garuda Linux “Raptor” 230305 Release Drops Latte Dock, Brings Key Changes"
[#]: via: "https://debugpointnews.com/garuda-linux-raptor-230305/"
[#]: author: "arindam https://debugpointnews.com/author/dpicubegmail-com/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15615-1.html"
Garuda Linux “Raptor” 230305 版本发布
======
![][1]
> Garuda Linux 是流行的基于 Arch Linux 的发行版,它刚刚发布了一个新的版本 “Raptor” 230305带来了新的功能和更新。
![Garuda Linux Raptor 230305][2]
Garuda Linux 是一个基于 Arch Linux 的发行版,由于其开箱即用的体验、游戏支持和用户友好界面,在 Arch Linux 爱好者中越来越受欢迎。Garuda Linux 以其对性能、速度和稳定性的关注而闻名。
最近Garuda Linux 发布了一个新的版本 “Raptor” 230305带来了新的功能和更新。在这篇文章中我们将介绍 Garuda Linux 的最新版本的新内容。
### Garuda “Raptor” 230305 的新内容
Garuda 的主要旗舰版是 dr460nized 版,采用 KDE Plasma 桌面环境,但它用 Latte Dock、图标主题等进行了大量定制。
由于 Latte Dock 现在已经没有支持了Garuda 团队完全删除了 Latte Dock用标准的 Plasma 面板取代了它。按照该团队的说法,“由于失去了顶栏颜色/透明度等功能,在一定程度上削弱了 dr460nized 版的吸睛因素”。
这的确是事实。但是,没有其他停靠区软件能像 Latte Dock 一样。我的意思是,虽然有,但它们都没有接近 Latte Dock 曾经提供的功能和灵活性。但好处是KDE Plasma 在 Garuda 中可能会变得更稳定,因为它现在使用了原生的停靠区和面板。而且它看起来也很好!
![新的原生 KDE 面板][3]
那么,如果你已经在运行带有 Latte Dock 的早期版本的 Garuda 呢?
为了解决这个问题,团队调整了 “<ruby>Garuda 系统维护<rt>Garuda System Maintenance</rt></ruby>” 应用程序,以检测你是否已经在运行 Latte Dock并为你提供逐步迁移到新的面板的方法。一旦你确认从 Latte Dock 迁移,它还会备份你的配置,以防迁移过程中出现问题。这方面的更多信息可以在这个 [指南][4] 中找到。
除了上述变化Garuda Linux “Raptor” 230305 还重写了设置帮助,改进了标签式界面和检测英伟达硬件的能力。
这个版本的一个重要更新是Garuda 现在使用 Dracut 来创建 initramfs而不是像包括原本的 Arch Linux 在内的大多数 Arch 发行版常见的 mkiniticpio。
不止如此。从这个版本开始有了一个新的 “garuda” 软件库,它是为 Garuda Linux 专属的软件包创建的,并从当前的 Chaotic-AUR 软件库中移出。这是最大的变化之一,它通过 “garuda-update” 自动处理的。可以在 [这里][5] 了解更多。
![当前的 pacman 软件库顺序][6]
在核心部分,这个版本带有最新的 [KDE Plasma 5.27.2][7] 桌面和 Linux 内核 6.2.2。所以,由于滚动发布,你可以得到所有最新的软件包。
如果你想探索更多的更新,你可以 [在此][8] 阅读整个更新日志。
要下载它,请访问以下页面并选择你要下载的变体:
> [下载 Garuda Linux][9]
如果你已经在运行 Garuda Linux那么从欢迎程序中启动 <ruby>Gaurda 帮助<rt>Gaurda Assistance</rt></ruby>,并点击 “<ruby>系统更新<rt>system update</rt></ruby>”。
### 总结
这是一个重要的 Garuda 版本,涉及到其旗舰 KDE 版的所有主要组件。对 pacman 偏好和 Dracut 的核心更新更是影响了所有的版本。
然而,所有的变化都是为了使它成为一个比以前更稳定的系统。我希望它能继续带来这样的更新,成为最好的 Arch Linux 发行版之一。
参考自 [发布公告][10]。
--------------------------------------------------------------------------------
via: https://debugpointnews.com/garuda-linux-raptor-230305/
作者:[arindam][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://debugpointnews.com/author/dpicubegmail-com/
[b]: https://github.com/lkxed/
[1]: https://debugpointnews.com/wp-content/uploads/2023/03/garuda-head.jpg
[2]: https://debugpointnews.com/wp-content/uploads/2023/03/Garuda-Linux-22Raptor22-230305.jpg
[3]: https://debugpointnews.com/wp-content/uploads/2023/03/New-native-KDE-panel.jpg
[4]: https://wiki.garudalinux.org/en/dr460nized-migration
[5]: https://forum.garudalinux.org/t/separating-garuda-packages-from-chaotic-aur/20506
[6]: https://debugpointnews.com/wp-content/uploads/2023/03/Current-pacman-repo-order.jpg
[7]: https://debugpointnews.com/kde-plasma-5-27-release/
[8]: https://forum.garudalinux.org/t/garuda-linux-raptor-230305/26929#you-want-to-read-the-exhaustive-changelog-sure-it-can-be-found-below-as-usual-laughing-10
[9]: https://garudalinux.org/downloads.html
[10]: https://forum.garudalinux.org/t/garuda-linux-raptor-230305/26929

View File

@ -0,0 +1,65 @@
[#]: subject: "Vanilla OS Drops Ubuntu, Welcomes Debian Sid"
[#]: via: "https://debugpointnews.com/vanilla-os-debian/"
[#]: author: "arindam https://debugpointnews.com/author/dpicubegmail-com/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15612-1.html"
Vanilla OS 放弃 Ubuntu转投 Debian Sid
======
![][1]
> 即将推出的 Vanilla OS 2.0 “Orchid” 将基于 Debian Sid 而不是 Ubuntu Linux。
来自 Ubuntu 的 [Flatpak 决定][1a] 的余震仍在继续Vanilla OS 团队宣布Vanilla OS 的下一个版本将不再基于 Ubuntu。它将基于 Debian Sid这是 Debian Linux 的 “滚动” 版本,或者说 “不稳定” 版本。
> 如果你不知道Vanilla OS 是一个新的不可变 Linux 发行版,它首次发布于去年。它的目标是提供 GNOME 桌面的 “原味” 体验。它有一套独特的工具,如 apx 软件包管理器、ABRoot 技术、原装 GNOME 体验等等。它基于标准的 Ubuntu 发布周期和版本进行发布。
![Vanilla OS 22.10 Kinetic 桌面][2]
### Vanilla OS 计划基于 Debian
由于这些重大变化Vanilla OS 的下一个版本将被命名为 “2.0” “<ruby>兰花<rt>Orchid</rt></ruby>”。但为什么要远离 Ubuntu 呢?
正如该团队所说,花了更多的困难和精力 **“来恢复 Canonical 武断的工作流程”**这需要更多的开发时间。另外Ubuntu 提供的 GNOME 是根据 Canonical 的需求和愿景定制的。所以,没有太多的 “原味” 体验。
第二个原因是处理 Snap 的问题。经过几次测试和社区反馈,团队认为目前的 Snap 并不适合 Vanilla OS 的使用情况。例如,“启动慢、集中化” 的问题在 Snap 核心里没有得到解决,而且 Snap 不能在 Vanilla OS 的 apx 容器内运行。
### 发布模式
此外,脱离 Ubuntu 的基础会带来一个更灵活的发布周期,将不需要遵循每年两个版本的周期。这给了小型 FOSS 开发者和贡献者团队一些喘息的空间。
但是未来的发布模式是什么呢?团队将遵循一种临时性的发布方式,用著名的术语来说就是 —— “当需要或准备好时就会发布”。例如,如果某个 Debian Sid 软件包得到一个关键的 CVE 修复,那么你可能会立即得到一个 Vanilla OS 的小版本。所以,这要视情况而定,应该以需求为基础。
此外,该团队还计划减少 ISO 文件中的软件包数量,以减少软件包 “不稳定” 因素的风险。但根据我使用 Debian Sid 的经验,如果你遵循适当的更新并谨慎行事,它可以视作一个 “稳定” 的发行版。
另外,其他变化还有对 ABRoot 的 OCI 更新,以加强对更新的控制。在设置中的一个新的快速的高级选项是即将发布的版本中值得注意的内容。
在核心方面,基于 Debian Sid 软件包情况,新版本计划采用 GNOME 44 和主线内核 6+。
### 结论
总之,基于 Debian 的确是一个大的进步。虽然它确实在发布周期上提供了更多的灵活性,但在向用户提供稳定版之前,它也会对 Sid 软件包进行更仔细的测试。总的来说,在我们等待 Vanilla OS 2.0 “Orchid” 的测试版本时,未来的时间是令人期待的。
参考自 [公告][3]。
--------------------------------------------------------------------------------
via: https://debugpointnews.com/vanilla-os-debian/
作者:[arindam][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://debugpointnews.com/author/dpicubegmail-com/
[b]: https://github.com/lkxed/
[1]: https://debugpointnews.com/wp-content/uploads/2022/12/vanilla-os-logo.jpg
[1a]: https://linux.cn/article-15570-1.html
[2]: https://debugpointnews.com/wp-content/uploads/2022/12/Vanilla-OS-22.10-22Kinetic22-Desktop.jpg
[3]: https://vanillaos.org/2023/03/07/vanilla-os-2.0-orchid-initial-work.html

View File

@ -0,0 +1,232 @@
[#]: subject: "How to Install MiniKube on RHEL 8/Rocky Linux 8/AlmaLinux 8"
[#]: via: "https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/"
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15630-1.html"
如何在 RHEL 8 上安装 MiniKube
======
![][0]
> 在这篇文章中,我们将逐步介绍如何在 RHEL 8、Rocky Linux 8 或 AlmaLinux 8 上安装 MiniKube。
MiniKube 是一个跨平台的开源工具,可以让你在本地机器上部署单节点 Kubernetes 集群。
Kubernetes也被称为 k8s或简称 Kube是一个开源的容器编排平台用于容器的自动化扩展和部署。MiniKube 集群帮助开发人员和管理员在集群中构建他们的测试环境。
##### MiniKube 的先决条件
- 最小化安装的 RHEL 8 或 Rocky Linux 8 或 AlmaLinux 8
- 本地配置的 RHEL 8 仓库或订阅
- 至少 2GB RAM 和 2 个 vCPU
- 20GB 硬盘空间
- 具有管理员身份的 sudo 用户
- 稳定的互联网连接
- Docker 或虚拟机管理器,如 VirtualBox、KVM 和 VMware 等
在这篇文章中,我们将使用 Docker 作为 MiniKube 的驱动程序。满足所有先决条件后,现在是时候卷起袖子动手了。
### 步骤 1启用官方 Docker 仓库
要启用 Docker 官方仓库,运行:
```
$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
$ sudo dnf repolist
```
![][1]
### 步骤 2安装 Docker CE社区版
运行以下 `dnf` 命令来安装 Docker 及其依赖项:
```
$ sudo dnf install docker-ce docker-ce-cli containerd.io -y
```
输出:
![][2]
安装 Docker 后启动并启用它的服务,运行以下 `systemctl` 命令:
```
$ sudo systemctl start docker
$ sudo systemctl start docker
```
允许你的本地用户在没有 `sudo` 的情况下运行 `docker` 命令,运行:
```
$ sudo usermod -aG docker $USER
$ newgrp docker
```
### 步骤 3安装 kubectl 二进制文件
`kubectl` 是一个命令行工具,它通过 API 与 Kubernetes 集群进行交互。我们使用 `kubectl` 部署应用。默认情况下,`kubectl` 不包含在 RHEL 8 、Rocky Linux 8 或 AlmaLinux 8 软件包仓库中。因此,我们将使用下面的命令手动安装它:
```
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ sudo cp kubectl /usr/local/bin/ && sudo chmod +x /usr/local/bin/kubectl
$ kubectl version --client
```
以上命令的输出如下所示:
![][3]
### 步骤 4下载 MiniKube 二进制文件并启动集群
安装 `kubectl` 后,让我们使用以下命令下载并安装 MiniKube 二进制文件:
```
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube
```
现在使用下面的命令启动 MiniKube 集群:
```
$ minikube start --driver docker
```
![][4]
上面的输出确认 `minikube` 命令已经使用 `docker` 作为驱动程序启动了单节点 Kubernetes 集群。
运行下面的 `minikube` 命令来验证本地 Kubernetes 集群的状态:
```
$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
$
$ minikube ip
192.168.49.2
$
```
要停止 MiniKube 集群,请执行:
```
$ minikube stop
```
执行 `kubectl` 命令查看集群和节点信息:
```
$ kubectl cluster-info
$ kubectl get nodes
```
![][5]
### 步骤 5测试和验证 Kubernetes 集群
为了测试 Kubernetes 集群,让我们尝试使用 echo 服务器镜像创建 k8s 部署,它相当于 HTTP Web 服务器并将其作为服务暴露在端口 8080 上:
```
$ kubectl create deployment test-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/test-minikube created
$
```
要访问 `test-minikube` 部署,将其公开为服务,运行以下命令:
```
$ kubectl expose deployment test-minikube --type=NodePort --port=8080
service/test-minikube exposed
$
```
运行以下 `kubectl` 命令以获取上面创建的部署、<ruby>容器荚<rt>pod</rt></ruby> 和服务信息:
```
$ kubectl get deployment,pods,svc
```
![][6]
要访问服务,请通过运行下面的命令获取其 URL
```
$ minikube service test-minikube --url
http://192.168.49.2:32291
$
$ curl http://192.168.49.2:32291/
```
![][7]
太好了,这意味着我们的 Kubernetes 集群工作正常,因为我们能够访问我们的示例应用。
##### 步骤 6启用 MiniKube 插件
MiniKube 提供插件,可以为我们的集群添加额外的功能。要列出所有可用的插件,运行:
```
$ minikube addons list
```
![][8]
Kubernetes 附带一个仪表板,可让你管理集群。在 MiniKube 中,仪表板已作为插件添加。所以要启用它,运行:
```
$ minikube addons enable dashboard
```
还要启用 nginx 入口控制器,运行:
```
$ minikube addons enable ingress
```
![][9]
要访问仪表板,运行:
```
$ minikube dashbaord --url
```
这将在你系统的浏览器中启动仪表板。
![][10]
就是这些了。我们已经成功地在 RHEL 8、Rocky Linux 8 或 AlmaLinux 8 上使用 MiniKube 安装了 Kubernetes。欢迎你在下面的评论部分分享你的反馈和意见。
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/
作者:[Pradeep Kumar][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lkxed/
[1]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Enable-Docker-Repo-RHEL8-Rocky-Linux8-1024x203.png
[2]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Install-Docker-DNF-Command-RHEL8-RockyLinux8.png
[3]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Download-Kubectl-Binary-RHEL8-RockyLinux8.png
[4]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Start-Minikube-Cluster-RHEL8-Rocky-Linux8.png
[5]: https://www.linuxtechi.com/wp-content/uploads/2020/04/K8s-cluster-info-RHEL8-RockyLinux9-1024x193.png
[6]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Kubectl-get-pods-deplyments-service-rhel8-rocky-linux8.png
[7]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Access-Application-minikube-rhel8-rockylinux8.png
[8]: https://www.linuxtechi.com/wp-content/uploads/2020/04/minikube-addons-list-rhel8-rockylinux8.png
[9]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Enable-Minikube-addons-RHEL8-RockyLinux9-1024x381.png
[10]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Kubernetes-Dashboard-MiniKube-Dashboard.png
[0]: https://img.linux.net.cn/data/attachment/album/202303/15/232024hn8312yg1qmy7mhv.jpg

View File

@ -0,0 +1,101 @@
[#]: subject: "8 examples of influential women in tech"
[#]: via: "https://opensource.com/article/23/3/international-womens-day-tech-influence"
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
[#]: collector: "lkxed"
[#]: translator: "XiaotingHuang22"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15621-1.html"
8 位有影响力的科技界女性
======
![][0]
> 社区成员分享了影响了其科技生涯的重要女性的故事。
一段开源之旅往往不是独自一人能完成的。你的爱好、职业和生活都受到了科技领域其他人的影响,而数据表明这其中一些影响力来自于女性。这是国际妇女节存在的众多原因之一,也是一起回顾你技术职业生涯中的女性的一个很好的理由。我们向 Opensource.com 的贡献者询问了他们的想法。
### 励志的女性们
#### Kathleen Greenaway 博士
我的大学教授 [Kathleen Greenaway 博士][1] 是激励过我的女性之一。她正是我想成为的人。我记得她在一次关于打破玻璃天花板的女性活动中说,她无法相信这么多年后我们还在谈论这个问题。我现在发现自己也是这么想的。这只是其中一个例子,但她就是这样。
—— [Shanta Nathwani][2]
#### Hilary Mason
我对 PHP 的入门要归功于 [Hilary Mason][3]。当她在普罗维登斯 RI 的 Johnson & Wales 担任教授时,她开了一门服务器端编程的选修课。她向我们展示了 PHP并在最后一个项目中让我们使用数据库构建了一些东西。我记得我建立了一个简单的登录系统和一个评论工具之类的。我喜欢告诉人们我是从一个女性那里学来的 PHP她还是 bit.ly 的首席数据科学家!)
—— [John E. Picozzi][4]
#### Carie Fisher
对我来说,科技界最鼓舞人心的女性是 [Carie Fisher][5]。我是在刚开始参与无障碍社区时遇到的她。她邀请我一起帮助项目,并在我申请工作、获得认证和在会议上发言时帮助我克服了冒名顶替综合症。在对技术包容性的激情和奉献精神上,只有少数人能与她相提并论。
—— [AmyJune Hineline][6]
#### Kanopi Studios
我在技术领域工作了 25 年,并且经常是公司或部门中唯一的女性开发人员。然后我加入了 Kanopi Studios这是一家由女性拥有和领导的机构这里有许多聪明、精通技术的女性员工我每天都从她们那里得到启发。我的性别不再是我事业成功的障碍。我感觉自己受到尊重和并被倾听我的成就也得到认可。
—— [Cindy Williams][7]
#### Barbara Liskov 和 Sandi Metz
我认为 Barbara Liskov 是我们领域中最有影响力的人物之一,我也非常喜欢 Sandi Metz她的演讲和教学技巧对我的职业生涯帮助很大。我推荐她的所有书籍和会议视频。
—— [benelori][8]
#### 家庭
在我的生活中,无论是个人还是职业上,我受到了许多女性的启发。我总是说我的母亲、姐姐和祖母在所有事情上都是我很好的参考对象。我现在有很棒的同事,他们也是我的榜样。我总是这样想:尽力和那些对你很重要的人保持紧密联系。在我刚学习编程开发那时候,我们没有任何参考榜样。没有人告诉我们 [第一个程序员是女性][9],亦或我们能够拥有 WiFi 和 GPS 是多亏了一位女性。我现在正在读一本非常好的书 —— 《[The Invisible Woman][10]》,我强烈推荐。
—— [Marta Torre][11]
#### Sarah Drasner
《[我们其他人的工程管理][12]》由一位杰出的科技女性撰写,作者是 Sarah Drasner。这本书让我注意到了另一位杰出的科技女性。这本书还有我们出色的开发经理 Jody她将书的副本发给了业内的所有领头人物促使我做出了一个决定——不断深化讨论了解我们在面对反馈时的不同经历。我们意识到很多人可能甚至不知道如何谈论他们需要什么或者什么对他们有用。因此我们希望可以用一场公开或随意的聊天对话作为一次非常有用的协作学习体验在对话中人们分享一些好的和坏的经历当然这些分享都是非强制的并看一些不同风格的案例。
—— [Fei Lauren][13]
#### Sheryl Sandberg
在德国汉诺威举行的 WomenPower 会议上,有人推荐给我人生中的第一本关于科技界女性的书,它是<ruby>雪莉·桑德伯格<rt>Sheryl Sandberg</rt></ruby> 的 《[精益求精:女性、工作和领导意愿][14]》。我不仅对她自己的工作方式印象深刻,还对她如何成功地运用我们作为女性被赋予的权力以及她和公司的成功的是如何改变了我们的事例感到钦佩不已。
—— [Anne Faulhaber][15]
### 自己的影响力
在开源领域,或许比其他地方更甚,我们都是彼此影响着的。共享和协作的精神植根于开源的发展过程。告诉我们你在开源之旅中受到过谁的影响吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/international-womens-day-tech-influence
作者:[AmyJune Hineline][a]
选题:[lkxed][b]
译者:[XiaotingHuang22](https://github.com/XiaotingHuang22)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/amyjune
[b]: https://github.com/lkxed/
[1]: https://www.linkedin.com/in/kathleen-greenaway-4076247/
[2]: https://opensource.com/users/shanta
[3]: https://en.wikipedia.org/wiki/Hilary_Mason_(data_scientist)?wprov=sfti1
[4]: https://opensource.com/users/johnpicozzi
[5]: https://www.linkedin.com/in/cariefisher
[6]: https://opensource.com/users/amyjune
[7]: https://opensource.com/users/cindytwilliams
[8]: https://opensource.com/users/benelori
[9]: https://opensource.com/article/18/10/first-computer-programmer-ada-lovelace
[10]: https://www.penguinrandomhouse.com/books/623964/the-invisible-woman-by-erika-robuck/
[11]: https://opensource.com/users/martatorredev
[12]: https://www.engmanagement.dev/
[13]: https://opensource.com/users/feilauren
[14]: https://leanin.org/book
[15]: https://opensource.com/users/afaulhab
[0]: https://img.linux.net.cn/data/attachment/album/202303/12/230653haa2i2ss87k0zvy3.jpg

View File

@ -0,0 +1,63 @@
[#]: subject: "What cloud developers need to know about hardware"
[#]: via: "https://opensource.com/article/23/3/cloud-hardware"
[#]: author: "Jay Faulkner https://opensource.com/users/jayf"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15634-1.html"
云开发人员需要了解的硬件知识
======
![][0]
> 云无处不在,所以硬件比以往任何时候都更加关键。
我们很容易忘记技术人员所取得的进步。在 2000 年代初期大多数本地用户组LUG定期举行安装节。那时要配置一台机器来很好地运行 Linux我们必须了解有关硬件的详细信息以及如何配置它。现在将近二十年后有了一个项目其核心理想是让一台计算机运行 Linux 就像 API 调用一样简单。在这个新世界中,运维人员和开发者等不再需要担心服务器中的硬件。这种变化对下一代的运维人员和开发者产生了深远的影响。
在计算机技术的早期,你不得不经常接触硬件。如果计算机需要更多内存,你只需添加它即可。随着时间的推移,技术也有了很大的发展。这最终使运维人员远离硬件。过去需要去数据中心一趟,现在变成了远程操作硬件的支持工单。最终,硬件被完全摆脱了。相反,你现在可以通过简单的命令召唤和摧毁“服务器”,而不必再担心硬件问题。
这里是真正的真相:硬件的存在是因为需要它来为云提供动力。但是,云到底是什么?
### 为什么硬件对云至关重要
云是建立在利用抽象集中的基础资源之上的。它的范围可以从简单的在你的 [家庭实验室][1] 中运行几个虚拟机的管理程序,到复杂的包括定制服务器、网络设备、容器和从头开始设计的专注于规模效率的技术。
它们是模糊的。它们在进化。
今天那些进入技术领域的人没有那些更有经验的开发人员实践经验。许多人从最早与计算机交互时就接受过使用云的培训。他们不知道不用按钮来更改内存分配的世界。他们可以将注意力转移到技术栈的更高层次。然而,如果不了解他们所使用的基础架构所建立的基础,他们就会含蓄地放弃学习栈较低级别(包括硬件)的机会。这里没有说错,因为云基础设施的实施者和运维人员已经做出了特定的选择,有意让他们的产品更易于使用。
这意味着现在,你比以往任何时候都更需要有意识地考虑在选择使用云技术时你或其他人做出的权衡。大多数人在收到第一份超额的云账单或第一次因“吵闹的邻居”造成的中断之前,不会知道已经做出了哪些权衡。企业能否信任他们的供应商做出最适合他们运营的权衡?供应商会建议更有效或更有利可图的服务吗?让买家(或工程师!)当心。
有意识地考虑权衡取舍需要从多个角度审视你的要求和目标。基础设施决策和其中的权衡是该项目的整个过程、设计或使用模型所固有的。这就是为什么必须尽快计划它们的原因。必须考虑多种不同的路径,以便为你的项目找到一个合适的归宿。
首先是要实现的目标或提供的服务的轴心。这可能伴随着速度、质量或性能方面的要求。这本身可以驱动许多变量。你可能需要专用硬件(例如 GPU才能以可接受的速度处理请求。此负载是否需要自动缩放当然这些路径是交织在一起的。问题已经跳转到“我的钱包会自动缩放吗
业务需求是要考虑的另一部分。你的项目可能有特定的安全或合规性要求,这些要求规定了数据的存储位置。邻近相关服务也是一个潜在的问题。这包括确保与附近证券交易所的 [低延迟连接][3] 或能够提供高质量的本地视频缓存作为内容交付网络CDN的一部分。
然后是最后一部分,即所提供服务的价值和成本:一个人希望或可以花多少钱来满足要求。这与第一条路径紧密相关。你的业务是“什么”以及你的业务“如何”运作。这可以像你的企业更喜欢资本支出还是更喜欢运营支出一样普通。
当看到这些选项时,很容易看到改变任何一个变量都会开始改变其他变量。它们在本质上是相互交织的,一些技术可能允许这些变量动态变化。如果不了解较低层次的底层,你就有可能采取推动这种动态计费模式的路径。对一些人来说,这是首选。对其他人来说,这可能是令人恐惧的。
尽管在现代技术栈中,学习特定的硬件知识已变得更加可有可无,但我们希望这篇文章能鼓励你去研究你可能在不知不觉中错过的东西。硬件的改进是功能交付和效率提高的一个重要部分,将计算机从房间大小的怪物缩小到小到可以植入人体内。我们希望你花时间停下来,学习并考虑你的下一个项目将在什么硬件平台上运行,即使你不控制它。
如果你是一个还没有把头从云端拿出来的学生,去找一台 [旧电脑][5],安装一根内存,挑战自己,学习新东西。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/cloud-hardware
作者:[Jay Faulkner][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jayf
[b]: https://github.com/lkxed/
[1]: https://www.redhat.com/sysadmin/linux-homelab-rhel?intcmp=7013a000002qLH8AAM
[3]: https://enterprisersproject.com/article/2022/5/edge-computing-latency-matters?intcmp=7013a000002qLH8AAM
[5]: https://opensource.com/article/22/4/how-linux-saves-earth
[0]: https://img.linux.net.cn/data/attachment/album/202303/16/235848zp97m0b7en0nwm7e.jpg

View File

@ -0,0 +1,279 @@
[#]: subject: "Top 5 Best EPUB Readers for Linux [Compared]"
[#]: via: "https://www.debugpoint.com/epub-readers-linux/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "robsean"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15651-1.html"
Linux 上 5 款最好的 EPUB 阅读器
======
![][0]
> 你正在寻找 Linux 上最好的 EPUB 阅读器?这里是为你准备的最好的自由开源的 EPUB 阅读器。
你是一位热衷于阅读电子书的 Linux 用户吗?如果,是的,你必然知道在 Linux 发行版上的默认文档阅读器不能满足你作为一名书虫的所有要求。
EPUB 是一种广泛使用的开放电子书格式,大多数的电子书阅读器都支持。值得庆幸的是,在 Ubuntu 软件中心和其它存储库中有一些 EPUB 阅读器应用程序,你可以自由下载它们。.
但是,请记住,仅有几个好用的阅读器。并不是有很多!
在这篇文章中,我们将讨论在 Ubuntu Linux 上的最好的 EPUB 阅读器,这将增强你的阅读体验。我们也将探讨它们的特色功能和优点,以便你可以选择一个适合你的应用程序。
但是,在此之前,你认为在一个 “令人满意的” EPUB 阅读器中,应该有哪些功能呢?
### 在一款 EPUB 阅读器中所应该有的功能
- **用户界面**:一款好的 EPUB 阅读器应该有一个简单易懂的用户界面,它会使导航和自定义你的阅读体验变得简单。你并不是在阅读一本实体书,因此,对于 “实体书” 的阅读体验来说,用户界面是极其重要的!
- **自定义**:拥有自定义字体大小、字体类型、背景颜色和其它设置的能力,它们将增强你的阅读体验。
- **书架**:书架是一种很方便的特色功能,它允许你组织你的 EPUB 文件和保持追踪你的阅读进度。
- **注释**:在你的 EPUB 文件中,高亮显示、下划线和添加注释是一种很重要的特色功能,它会帮助你记住重点。
- **同步**:如果你在多台设备上阅读 EPUB 文件,同步你的阅读进度和书签是非常重要的,可以避免丢失你的追踪进度.
现在,让我们看看为 Ubuntu 和其它的 Linux 发行版提供的最好的 EPUB 阅读器,它们都涉及上述所有的特色功能。
### 在 Ubuntu 和其它 Linux 发行版上的最好的 EPUB 阅读器
#### Calibre
在这份列表上的第一款阅读器是 Calibre ,它是最好的和最完善的电子书管理解决方案。它是一款功能强大的 EPUB 阅读器,也提供电子书管理工具。它在用户中是一种流行的选择,因为它有丰富的特色功能集,包括:转换 EPUB 文件到不同的格式、编辑 EPUB 文件,甚至创建你自己的 EPUB 文件的功能。Calibre 也有一个用户友好的界面,允许你自定义你的阅读体验。
![Calibre welcome wizard][1]
Calibre 正在持续更新,每个月都会有大量的特色功能和增强的功能。它的开发活动是非常活跃的,它是这份列表中最好的一个。
功能摘要:
- 支持多种电子书设备基于安卓、iOS 的设备)
- EPUB 阅读器和管理器
- 为你的电子书库评级和标记
- 从互联网获取电子书的元数据
- 从流行的新闻源处阅读新闻,并制作电子书!
- 使用自动转换器来上传电子书到 Kindle 和其它的阅读器(当然,也可以下载)
- 内置可购买电子书的浏览器
![Calibre main window][2]
![Uploading books to Calibre][3]
你可以从其官方网站下载 Calibre 。或者,你可以为你的 Linux 发行版 [设置 Flatpak & Flathub][4] ,并单击下面的按钮(或使用命令)来安装:
> **[使用 Flatpak 来安装 Calibre][5]**
```
flatpak install com.calibre_ebook.calibre
```
针对其它的下载选项Windows、macOS 和原生的 Linux 软件包),请访问 [这个网页][6]。
#### Foliate
我们在先前的 [最佳的 Ubuntu 应用程序(第 3 部分)][7] 系列中介绍了 Foliate 。它是一款轻量现代的 EPUB 阅读器,它提供了一系列的自定义选项。它是基于 GTK4 的,并且与 GNOME 桌面环境无缝集成。它有一个平滑且易于导航的界面,并且有自定义字体大小、字体类型和行距的功能。
![Foliate main window and settings][8]
Foliate 也包含:一种针对夜间阅读的深色模式,一个调整内置颜色温度的选项,用以减少眼睛疲劳。
功能摘要:
- 沉浸式视图,主顶部工具条在阅读时自动隐藏
- 列入目录视图,支持从主要的电子书网站直接下载
- 多屏视图 双页面视图和滚动视图
- 自定义字体和行距
- 内置亮度控制,仅应用于应用程序本身!
- 阅读进度滑块
- 支持书签和注释
- 在书中搜索
- 快速字典查找
![Foliate reader view][9]
![Foliate library view][10]
下载 Okular 的最好方式是使用 Flatpak 来下载。针对你的系统设置 [Flatpak & Flathub][4] ,并使用下面的链接(或使用下面提到的命令)来安装它:
> **[使用 Flatpak 来安装 Foliate][11]**
```
flatpak install com.github.johnfactotum.Foliate
```
要学习更多关于 Foliate 的信息,访问官方 [网站][12]。
#### Okular
KDE 自带的文档阅读器是 Okular ,它也支持 EPUB 文件。它是一款功能丰富的应用程序它提供了一系列自定义选项包括字体大小、字体类型和背景颜色。Okular 也有内置注释功能,你可以使用它来注释你的 EPUB 文件。它也支持很多文件格式:
- EPUB
- PDF
- DjVU
- 图形文件: JPEG 、PNG 、GIF 、Tiff 、WebP
- 漫画文件: CBR 和 CBZ
不过,你不能使用 Okular 来管理收藏或下载电子书。
![Okular][13]
你可以在 Ubuntu 及其相关发行版中安装 Okular
```
sudo apt install okular
```
针对 Fedora 及其相关发行版:
```
sudo dnf install okular
```
如果你更喜欢 Flatpak ,将你的系统设置为 Flatpak ,并使用下面的链接(或使用下面提到的命令)来安装 Flatpak
> **[使用 Flatpak 格式安装 Okular][14]**
```
flatpak install org.kde.okular
```
#### Bookworm
在这份列表上的下一个 EPUB 阅读器是 Bookwork ,在我看来,它完全被低估了。它确实是一款 elementary OS 的应用程序,但是,对于所有的 Linux 发行版来说都是可以安装的。
它有简洁的界面并提供一系列自定义选项包括字体大小、字体类型和背景颜色。Bookworm 也允许你将你的 EPUB 文件组织到集合中,并保持追踪你的阅读进度。
![Bookworm library view][15]
另外,你可以使用一个内置的标签编辑器和评分系列来轻松地管理你的 EPUB 书籍。此外,它也支持注释、搜索、章节和键盘导航。
不可缺少的是,它支持 EPUB 、MOBI 、PDF 、EB2 、CBR 和 CBZ 文件。
![Bookworm EPUB reader view][16]
安装是很容易的。如果你是一名 elementary OS 用户,你可以在 <ruby>应用中心<rt>AppCenter</rt></ruby> 中搜索 “bookworm” 。
针对 Ubuntu 及其相关发行版,你可以使用下面的 PPA 来安装它:
```
sudo add-apt-repository ppa:bookworm-team/bookwormsudo
apt-get update
sudo apt-get install com.github.babluboy.bookworm
```
如果你更喜欢 Flatpak ,将你的系统设置为 Flathub 和 Flatpak ,并使用下面的链接来安装它:
```
flatpak install com.github.babluboy.bookworm
```
要学习更多的信息,访问官方 [网站][17]。
#### FBReader
在这份最好的 EPUB 阅读器列表中最后一款应用程序是 FBReader 。在你继续阅读之前,注意:它在 2015 年以前是开源软件。但是,它现在是闭源软件,不过,有一个开发者 SDK 是可用的。
它是一款流行的多功能的 EPUB 阅读器,所有的 Linux 发行版都可以获取使用。它有一个简单且用户友好的界面允许你自定义你的阅读体验。FBReader 也支持各种电子书格式包括EPUB 、MOBI 、FB2 和 HTML 。它也提供一种书架特色功能,允许你组织你的电子书和保持追踪你的阅读进度。
FBRedaer 也支持在你的设备之间云同步你的库。
![FBReader][18]
在 Linux 上安装 FBReader 是有一些难度的,因为它只提供 Snap 软件包。你可以在 [针对 Snap 设置你的系统][19] 后,使用 `snap` 来安装它,如下所示。
```
sudo snap install fbreader
```
要学习更多关于 FBReader 的信息,访问官方 [网站][20]。
### 在 Linux 上的更多的 EPUB 阅读器
#### Koodo reader
它是一个相当新的自由及开源的 EPUB 阅读器,带有大量的特色功能。并且它也看起来极好。唯一的问题是,它是使用 Javascript 、HTML 和 TypeScript 构建的。因此,它不是原生的应用程序,但是它是很快的。你可能会想尝试一下。在 Linux 上Koodo reader 提供 AppImage 、本机的 deb 和 RPM 文件。
你可以 [在这里下载][21] ,这里是一些截屏。
![Koodo EPUB reader][22]
![Koodo - reader view][23]
![Koodo options][24]
这里还有另外的两个 EPUB 阅读器,但是,不幸的是,它们已经不再继续开发了。
- [GNOME Books][25]
- [epub CLI reader][26]
### EPUB 阅读器的对比表
为使你更容易地选择适合你所需要的 EPUB 阅读器,我们创建了一个比较表,着重强调了上述 EPUB 阅读器的关键特色功能。
| EPUB 阅读器 | 用户界面 | 自定义 | 书架 | 注释 | 同步 |
| :- | :- | :- | :- | :- | :- |
| Calibre | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Foliate | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
| Bookworm | ✔️ | ✔️ | ✔️ | ❌(受限)| ❌ |
| Okular | ✔️ | ✔️ | ❌ | ❌(受限)| ❌ |
| FBReader | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
### 去哪里获取免费的电子书?
很多网站为你提供来自著名作者的大量漫画和小说的收藏。最好的网站是 “Project Gutenberg” 。你可以下载来自所有分类中的 60,000 多本电子书。
使用下面的链接访问网站。在你下载电子书后,你可以使用上述任意的 EPUB 阅读器来制作和享受你的个人电子书收藏。
> **[Project Gutenberg][27]**
你也可以尝试精选免费电子书的 standard ebooks。
> **[Standard eBooks][28]**
### 总结
总而言之,在 Linux 上有几个可用的 EPUB 阅读器,它们提供大量的特色功能来增强你的阅读体验。如果你正在寻找一个功能丰富的 EPUB 阅读器Calibre 是一个极好的选择它也可以作为一个电子书管理器工具。Foliate 和 Bookworm 是一个轻量的现代的应用程序,非常适合那些看重自定义选项的人。
我希望通过上述的比较和详细的描述,你现在可以为你自己选择最好的 EPUB 阅读器了。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/epub-readers-linux/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/wp-content/uploads/2023/03/Calibre-welcome-wizard.jpg
[2]: https://www.debugpoint.com/wp-content/uploads/2023/03/Calibre-main-window.jpg
[3]: https://www.debugpoint.com/wp-content/uploads/2023/03/Uploading-books-to-Calibre.jpg
[4]: https://www.debugpoint.com/how-to-install-flatpak-apps-ubuntu-linux/
[5]: https://dl.flathub.org/repo/appstream/com.calibre_ebook.calibre.flatpakref
[6]: https://calibre-ebook.com/download
[7]: https://www.debugpoint.com/necessary-ubuntu-apps-2022/
[8]: https://www.debugpoint.com/wp-content/uploads/2023/03/Foliate-main-window-and-settings.jpg
[9]: https://www.debugpoint.com/wp-content/uploads/2023/03/Foliate-reader-view.jpg
[10]: https://www.debugpoint.com/wp-content/uploads/2023/03/Foliate-library-view.jpg
[11]: https://dl.flathub.org/repo/appstream/com.github.johnfactotum.Foliate.flatpakref
[12]: https://johnfactotum.github.io/foliate/
[13]: https://www.debugpoint.com/wp-content/uploads/2023/03/Okular.jpg
[14]: https://dl.flathub.org/repo/appstream/org.kde.okular.flatpakref
[15]: https://www.debugpoint.com/wp-content/uploads/2023/03/Bookworm-library-view.jpg
[16]: https://www.debugpoint.com/wp-content/uploads/2023/03/Bookworm-EPUB-reader-view.jpg
[17]: https://babluboy.github.io/bookworm/
[18]: https://www.debugpoint.com/wp-content/uploads/2023/03/FBReader.jpg
[19]: https://www.debugpoint.com/how-to-install-and-use-snap-packages-in-ubuntu/
[20]: https://fbreader.org/en
[21]: https://koodo.960960.xyz/en
[22]: https://www.debugpoint.com/wp-content/uploads/2023/03/Koodo-EPUB-reader.jpg
[23]: https://www.debugpoint.com/wp-content/uploads/2023/03/Koodo-reader-view.jpg
[24]: https://www.debugpoint.com/wp-content/uploads/2023/03/Koodo-options.jpg
[25]: https://gitlab.gnome.org/Archive/gnome-books
[26]: https://github.com/rupa/epub
[27]: https://www.gutenberg.org/
[28]: https://standardebooks.org/ebooks
[0]: https://img.linux.net.cn/data/attachment/album/202303/22/210742rdxxnfmfxmtfxnzx.jpg

View File

@ -0,0 +1,73 @@
[#]: subject: "Postgres DevOps database administrator: A day in the life"
[#]: via: "https://opensource.com/article/23/3/postgres-devops-dba"
[#]: author: "Doug Ortiz https://opensource.com/users/dougortiz"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15649-1.html"
Postgres DevOps 数据库管理员的日常
======
![][0]
> 数据库管理员DBA的职责是什么
在依赖 Postgres 作为主要数据库管理系统的现代 IT 组织中Postgres DevOps DBA 发挥着关键作用。Postgres DevOps DBA 的角色涉及许多职责、技能和任务。其中一些包括:管理数据库设计和架构、基础设施管理、确保高可用性、安全性以及执行日常维护任务(调整、备份和恢复以及监控)。
本文总结了当今企业环境中 Postgres DevOps DBA 的常见职责和技能。
### 数据库设计和架构
Postgres DevOps DBA 的两个主要职责是数据库设计和架构。该角色必须对应用的数据存储要求和涉及的业务逻辑有更深入的了解。这些知识包括设计和创建数据库模式和表。它还意味着配置索引和其他数据库对象以优化查询性能,并选择使用正确的 Postgres 版本。该角色必须确保数据库的设计具有可扩展性和可维护性,同时考虑到未来的增长和数据保留需求。
### 性能调优
另一个关键的职责是性能调优。Postgres DevOps DBA 必须能够通过监控数据库性能指标和分析查询性能来识别和解决性能问题。该角色还必须对数据库有深入的了解,并能够对其进行配置以获得最佳性能,包括优化查询和索引、调整内存设置以及识别和解决性能瓶颈。
### 备份与恢复
备份和恢复也是职责的关键。DBA 必须对备份和恢复解决方案有深入的了解,并且必须设计和实施备份策略,以确保在数据丢失的情况下始终可以恢复数据。他们还必须验证恢复过程并实施高可用性和灾难恢复解决方案,以最大限度地减少停机时间和数据丢失。
### 安全
安全是另一个重要的职责。DBA 通过实施访问控制、加密和其他安全措施来保护数据,从而确保数据库安全。他们还必须了解最新的安全趋势和最佳实践,并加以实施以防范潜在威胁。
### 基础设施管理
基础设施管理也是一项重要职责。这些 DBA 必须管理硬件、网络和存储基础设施,并提供基础设施以支持 Postgres。他们还必须针对性能和可用性配置基础架构并根据需要扩展基础架构以适应数据增长。
### 自动化和脚本
该角色必须能够使用 [Ansible][2]、Terraform 和 [Kubernetes][3] 等工具自动执行重复性任务,例如备份、监控和修补。他们还必须熟悉自动化最佳实践,以确保高效且有效地自动化任务。自动化减少了人为错误的可能性,提高了效率,并允许 DBA 专注于更复杂的任务。
### 监控和配置警报
监控数据库和基础设施并设置警报以通知他们问题非常重要。该角色还必须采取主动措施来防止停机和数据丢失,使用 Nagios、Zabbix 和 Prometheus 等监控工具来检测潜在问题。
### 合作
除了这些技术职责外PostgreSQL DevOps DBA 还必须与其他 IT 团队(例如开发人员、运维人员和安全人员)协作,以将数据库集成到更大的 IT 生态系统中。DBA 还必须记录他们的工作,并及时了解 Postgres 和 [DevOps][4] 的最新趋势和最佳实践。这涉及与利益相关者合作以收集需求、确定优先级并使数据库与组织的更广泛目标保持一致。
### 总结
总之Postgres DevOps DBA 在依赖 Postgres 作为主要数据库管理系统的现代 IT 组织中发挥着关键作用。你当前的技能和期望如何匹配此列表?作为现代数据库环境中的 DBA你是否走在正确的道路上
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/postgres-devops-dba
作者:[Doug Ortiz][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dougortiz
[b]: https://github.com/lkxed/
[2]: https://opensource.com/article/19/2/quickstart-guide-ansible
[3]: https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=7013a000002qLH8AAM
[4]: https://opensource.com/article/20/12/remote-devops
[0]: https://img.linux.net.cn/data/attachment/album/202303/22/075232pgphrt3nuhp1nu7r.jpg

View File

@ -0,0 +1,96 @@
[#]: subject: "Contribute to open source without code"
[#]: via: "https://opensource.com/article/23/3/non-code-contribution-open-source"
[#]: author: "Debra Chen https://opensource.com/users/debra-chen"
[#]: collector: "lkxed"
[#]: translator: "Cubik65536"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15633-1.html"
不编写代码也可以为开源项目做出贡献
======
![][0]
> 如果你想通过非代码贡献成为一个提交者,或者没有时间做代码贡献,那么第一步就是加入社区。
对于不同的人来说,开源“社区”意味着不同的东西。我认为开源有点像“爱情”,因为它是关于人和关系的。把开源当作一个社区,因为没有人,就没有源代码,无论是开源还是闭源。
我是 [Apache DolphinScheduler][1] 社区的成员。由于该项目有意保持低代码,因此它吸引了许多 [非软件开发人员][2]。有时,那些不编写代码的人不确定是否有一种有意义的方式来为主要由源代码组成的开源项目做出贡献。我的经验告诉我,有,我将在本文中解释原因。
### 向社区做出贡献
在 Apache DolphinScheduler 项目中,我主要负责全球运营、影响力和社区关怀。
一些人会说项目是树而开源是土壤。这是一个恰当的比喻,它说明了积极培育你想要帮助成长的东西的重要性。
我有一个更简单的想法:尽一切可能使其变得更好。
一个社区需要不断的关注,不是因为它很贪心,而是因为它是生活的一部分。社区是你身边的人,无论是物理空间还是在线空间。
自从加入开源社区以来,我已经独立发起并组织了一些活动,包括:
- 平均每月在中国举办一次会议。
- 建议社区参与大数据领域内的技术分享。
- 协调了中国“大数据”领域几乎所有的开源项目,与这些社区进行了个别访问和交流。
在我看来,一个优秀的项目应该在一个良好的生态系统中成长。社区需要走出去,交换想法,分享资源,并与其他优秀的社区合作。每个人都应该感受到社区在工作中带来的好处。
我的海外扩张遵循相同的模式。当然,由于文化和语言的差异,这样做很困难。这需要耗费精力,但这是值得的。
到目前为止,我们已经在包括美国、印度、新加坡、德国、法国、芬兰等国家成功举办了会议。
所以我如何为 DolphinScheduler 做出贡献?我是否向项目提交代码?我是社区经理吗?我有正式的职称吗?
我认为自己是一个助手。我促进沟通和联系,这与任何代码贡献一样,都是 “Apache Way” 的一个例子。
### 从 DolphinScheduler 开始
我第一次接触开源是在开放原子基金会工作时,担任开源教育运营经理。作为中国第一个开源基金会,开放原子运营了以 [OpenHarmony][3] 为代表的许多项目。
我加入了 DolphinScheduler 社区并发现了一群热衷于分享知识、提供指导和支持,并热衷于帮助其他人发现对他们自己的生活有用的工具的人。
DolphinScheduler 旨在成为一个拥有全球影响力的调度系统,帮助团队以 [敏捷][4] 和高效的方式工作。
### 对社区的第一印象
听到社区对项目开发的抱怨是一件常见的事情。我们都会时不时地抱怨。也许你报告了一个错误,但开发人员没有解决你的问题。或者,也许你有一个很棒的功能想法,但团队忽略了它。如果你是一个开源社区的成员,你以前就听到过这些不满,如果你没有,你最终会听到。
我了解到,这些声音对于开源社区来说都很重要。这是一个好现象,因为当你听到这些反馈时,这意味着社区愿意发现错误,报告它们,提出问题和回答问题。听到这些抱怨可能会揭示项目结构中需要改进的地方。社区中是否有志愿者可以回应错误报告并对它们进行分类,以便它们能够被分配给正确的开发人员?是否有一个志愿者组等待成立,以便迅速回应项目论坛或论坛中新人的问题?
开源项目的门口有一个招待员可以帮助邀请犹豫不决的社区成员。招待员还可以确保没有“门槛”。每个人都受欢迎,每个人都有自己的贡献,即使他们能提供的只是互相帮助的氛围。
尽管你我都希望能为每个人解决技术问题,但这是不现实的。但任何人都愿意帮助找到解决方案,这是社区的一个伟大优势。这些用户自发地充当了社区的“客户服务”部门。
在 DolphinScheduler 项目中我们有很多人Yan Jiang、Xu Zhiwu、Zhang Qichen、Wang Yuxiang、Xiang Zihao、Yang Qiyu、Yang Jiahao、Gao Chufeng 和 Gao Feng顺序不分先后。即使他们不开发解决方案他们也不遗余力地寻找能够开发解决方案的人。
### 给社区的话
如果你希望通过非代码贡献成为提交者,或者没有时间进行代码贡献,那么第一步就是加入社区。没有注册表格或批准流程,但也没有快速通道。你通过参与加入社区。你通过可靠且持续的参与与其他人建立关系。
我随时都可以聊天,总是渴望谈论全球活动组织、文档、反馈等。
### 成为提交者
Apache DolphinScheduler 面临着许多挑战。大多数公司,即使是支持开源的公司,也会选择非开源的商业工具。我希望与社区合作伙伴一起,使 DolphinScheduler 成为世界级的调度系统。我希望每个人都可以收获他们想要的技术成果,而 DolphinScheduler 可以帮助他们实现这一目标。
加入我们的社区,帮助我们推广开放和敏捷的工作方式。或者找到一个需要你非编码技能的项目。发现让你的同龄人社区获得力量是多么酷和有趣!
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/non-code-contribution-open-source
作者:[Debra Chen][a]
选题:[lkxed][b]
译者:[Cubik65536](https://github.com/Cubik65536)
校对:[wxy](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/debra-chen
[b]: https://github.com/lkxed/
[1]: https://dolphinscheduler.apache.org/en-us
[2]: https://opensource.com/article/21/2/what-technical
[3]: https://gitee.com/openharmony
[4]: https://opensource.com/article/22/5/practical-tips-agile
[0]: https://img.linux.net.cn/data/attachment/album/202303/16/231703lt3v8fw7t85uya30.jpg

View File

@ -0,0 +1,149 @@
[#]: subject: "Arch Linux vs Other Linux Distros: Which is Right for You?"
[#]: via: "https://www.debugpoint.com/arch-linux-vs-other-distros/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15631-1.html"
世界上只有两个 Linux 发行版Arch Linux 与其它
======
(经提醒,标注原文标题:**Arch Linux 与其他 Linux 发行版,哪个更适合你?**
![][0]
> 如果你打算把 Arch Linux 作为日常用机,你应该考虑一下 Arch Linux 与其他发行版的不同优点。下面是一个快速比较。
如果你考虑改用 Linux你会接触到数百个 Linux 发行版。每个 Linux 发行版都有其独特的功能、优势和劣势。
它们为用户提供了独特的功能、工具和界面的选择,以满足不同的需求。如果你想和 Arch Linux 进行比较,选择合适的 Linux 发行版,这可能会让人不知所措。
在这篇文章中,我将重点介绍 Arch Linux它是最受欢迎的 Linux 发行版之一,并将它与其他流行的 Linux 发行版进行比较。
### 关于 Arch Linux 的一些说明
Arch Linux 是一个轻量级和高度可定制的 Linux 发行版,最初发布于 2002 年。与其他流行的发行版不同Arch Linux 是一个简约的发行版采用自己动手DIY的方式。它是为中高级 Linux 用户设计的,他们喜欢控制和灵活性而不是易用性。
Arch Linux 遵循滚动发布模式,这意味着你可以经常用最新的软件包更新你的系统。
#### Arch Linux 的优点
Arch Linux 有很多优点。然而一个发行版到底好不好取决于你的使用情况或品味。这因人而异。但在我看来Arch Linux 比其他 Linux 发行版有几个优势,比如:
- 轻量级和快速(原装版的 Arch尤其是带有 Xfce 桌面的)
- 灵活性和定制化
- 最新的软件包
- 可靠和稳定(如果正确使用和维护的话)
- 通过 <ruby>Arch 用户仓库<rt>Arch User Repository</rt></ruby>AUR收集最广泛的软件包
- 通过测试软件仓库和安装提供开发包
现在,让我们简单了解一下主要和流行的 Linux 发行版。
### 其他主要发行版的简要概述
#### Ubuntu
Ubuntu 由 Canonical 创建,它是最受欢迎的 Linux 发行版之一,为所有用户和各种使用情况而设计。你可以将 Ubuntu 用于日常工作、开发环境、休闲浏览等方面。它以 Debian 为基础,提供了一个用户友好的 GNOME 桌面环境界面和优秀的软件管理工具。Ubuntu 每年发布两个版本,每两年有一个长期版本。
#### Fedora
Fedora 由 Red Hat 开发和资助,它是另一个流行的 Linux 发行版。它是为中高级用户构建的。它提供最新的软件包,并具有最先进的桌面环境。许多用户喜欢 Fedora因为它在采用现代技术时总是走在最前面。例如Wayland 显示服务器Piperwire 声音服务器,内存超出处理,以及许多其他技术都是由 Fedora 首先采用的。而 Ubuntu 紧随其后。
#### Debian
被称为 “通用操作系统” 的 Debian Linux 已经有二十多年的历史。它稳定、可靠具有大量的软件包。Debian 以支持所有计算机架构而闻名。Debian 的 “稳定” 版本被认为是当今最稳定的 Linux 发行版。虽然,它的发布节奏比这个名单中的其他版本要慢一些。
#### CentOS
CentOS 以其稳定性、安全性和可靠性而闻名被广泛用于企业环境中的服务器部署和管理。CentOS 基于红帽 Linux 企业版RHEL它为运行 Web 服务器、数据库和关键应用程序提供了一个强大和可扩展的平台。它提供的长期支持和频繁的更新使它在开发者、系统管理员和企业中很受欢迎。
### Arch Linux 与其他 Linux 发行版的比较
现在你对一些流行的 Linux 发行版有了一些了解,让我们把 Arch Linux 与其他 Linux 发行版进行比较。
#### 安装过程
多年来与其他发行版相比Arch Linux 的安装有一定的难度因为它需要手动安装和配置。然而Arch Linux 的安装过程为用户提供了更大的控制和定制选项。
但最近Arch Linux 团队通过 [archinstall][1] 脚本推出了一个菜单驱动的、易于操作的安装程序。利用它并掌握一些基本知识,现在可以直接安装 Arch Linux 了。此外Arch Linux 还提供了 [虚拟机和 Docker 镜像][2],这对加快 Arch Linux 的部署非常有用。
![archinstall 的最终分区表][3]
另一方面Ubuntu、Linux Mint 和 Fedora 等发行版有图形化的安装向导,更容易使用,适合初学者。
#### 软件包管理器
Arch Linux 的默认软件包管理器是 [Pacman][4],它以其速度和可靠性著称。它还具有 [Arch 用户仓库AUR][5],这是一个由社区驱动的用户贡献的庞大的软件仓库。
相比之下,其他发行版,如 Ubuntu 和 Debian 使用 APT<ruby>高级软件包工具<rt>Advanced Package Tool</rt></ruby>),而 Fedora 使用 DNF它也是可靠和快速的。
但根据我的经验如果你仔细选择镜像Pacman 要比 APT 和 DNF 软件包管理器快。
#### 滚动发布与定期发布比较
Arch Linux 与其他发行版的一个重要区别是其滚动发布模式。Arch Linux 提供了持续的更新,因此用户可以随时获取最新的软件包。相比之下,像 Ubuntu 和 Fedora 这样的发行版通过他们的标准发布计划来提供,需要一些时间。
Fedora 每 6 个月左右就会有定期发布的版本。Ubuntu 每年也有两个版本。虽然定期发布的版本提供了稳定性,但它们可能没有最新的软件包可用。
所以,这要归结为你自己的需要和工作流程。
#### 自定义和控制
Arch Linux 是为希望完全控制和定制自己的系统的用户设计的。原装的 Arch Linux 安装只安装基本的软件包,用户可以根据自己的需要添加其他软件。
根据你的使用情况,你可以选择安装你喜欢的浏览器、文本编辑器、媒体播放器、图像编辑器等等。没有什么是强加给你的。
其他发行版,如 Ubuntu 和 Fedora 提供了更多的预装软件包,使它们对初学者来说更容易使用。然而,它们可能没有提供像 Arch Linux 那样多的控制和定制功能。
但是,提供预装软件使许多用户、学校、学生和想要一个有预建项目的系统的老年人更轻松。
#### 稳定性和安全性
Arch Linux 以其稳定性和安全性而闻名,这主要是由于它对软件包的安装采取了简约的方法。用户可以完全控制他们安装的软件包,这使得它不容易受到安全漏洞的影响。
此外Linux 主线内核(主要和次要版本)每月都会在 Arch 软件仓库中率先发布。因此,总的来说,你可以放心,如果你保持你的 Arch Linux 定期更新,你几乎是安全的。
其他发行版,如 Debian 和 CentOS 也以其稳定性和安全性而闻名,但它们可能没有 Arch Linux 那样最新的软件包。
### 哪个 Linux 发行版适合你?
选择合适的 Linux 发行版取决于你的需求和专业水平。
如果你是一个有经验的 Linux 用户想要完全控制和定制Arch Linux 是一个很好的选择。如果你知道处理错误的基本方法,在错误升级的情况下可以绕过系统故障,那么它就是最好的选择。
然而,如果你是一个 [初学者][6] 或者喜欢开箱即用的体验Ubuntu、Linux Mint 或 Fedora 等发行版可能更好。
### 结论
选择合适的 Linux 发行版是一种挑战,但了解它们的差异可以帮助你做出明智的决定。
Arch Linux 是一个独特而强大的发行版,提供完全的控制和定制,但它可能并不适合所有人。
像 Ubuntu 和 Fedora 这样的流行发行版提供了易用性和更多的预装软件包,使它们成为初学者的绝佳选择。
最后,我希望这份指南能给你一个关于 Arch Linux 与其他发行版相比的基本指导。
加油。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/arch-linux-vs-other-distros/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/archinstall-guide/
[2]: https://archlinux.org/download/
[3]: https://www.debugpoint.com/wp-content/uploads/2022/01/Final-partition-table-for-archinstall.jpg
[4]: https://www.debugpoint.com/pacman-command-arch-examples/
[5]: https://www.debugpoint.com/aur-arch-linux/
[6]: https://www.debugpoint.com/linux-distro-beginners/
[0]: https://img.linux.net.cn/data/attachment/album/202303/16/091648yt6xxdjnc5tttn1z.jpg

View File

@ -0,0 +1,117 @@
[#]: subject: "A Guide to Find the Right Debian ISO for Download"
[#]: via: "https://www.debugpoint.com/download-debian-iso/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "robsean"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15662-1.html"
如何找到合适的 Debian ISO 来下载
======
![][0]
> Linux 初学者可能会被官方的 Debian 下载 ISO 的页面弄得不知所措。这篇指南旨在简化下载体验。
对于 Debian 初学者来说,安装 Debian 可能会是一次艰难的经历。官方的下载页面包含了不少链接,以至于到底需要下载哪个令人困惑。
我准备这篇指南来帮助你从下载页面挑选合适的 Debian ISO 文件。
总的来说,你可以将 Debian ISO 文件分为两大类。它们是 “自由” 和 “非自由” 。
### 关于 “自由” 和 “非自由” Debian 镜像之间的一些注意事项
- Debian “非自由” 镜像是指包含不符合 Debian 自由软件准则的软件包的 Debian 操作系统的安装镜像。
- “非自由” 软件包包含专有的、有版权的或受许可证限制的软件这些软件包禁止用户修改或分发代码。Debian 项目提供这些 “非自由” 镜像作为用户的一种可选下载项,以便他们使用需要专有驱动或固件的特定硬件设备或软件。
- “自由” 版本的 Debian仅包含开源和可自由分发的软件包这意味着用户有修改、分发和与他人分享的自由而不受任何法律和道德上的限制。
从 Debian 12 “Bookworm”即将发布之后非自由固件软件包将正式包含在主 ISO 文件中。因此,这篇指南将分为两个部分。
### 下载: Debian 12 “Bookworm”
这里是一份下载 ISO 版本的 Debian 12 “Bookworm” 的简单的表格(当前还不稳定,正在测试)。
| 描述 | 最大 ISO 体积 | **选择此 ISO 的情形** | ISO 下载链接amd64 |
| :- | :- | :- | :- |
| 最小的体积;非常适合基本安装 | 700 MB | 你想下载基础的软件包,然后通过互联网来安装 | [iso-cd][1] |
| 完整的 DVD 体积 | 5 GB | 你想先下载所有的东西,然后开始安装,它非常适合离线安装 | [iso-dvd][2] |
### 下载: Debian 11 “Bullseye”
#### 自由版本的 ISO 文件(没有专有软件包)
下面的 ISO 镜像是 “自由” 版本的镜像,这意味着它们不包含用于固件的大量专有软件包。
| 描述 | 最大 ISO 体积 | **选择此 ISO 的情形** | ISO 下载链接amd64 |
| :- | :- | :- | :- |
| 最小的体积(网络安装 CD需要联通互联网下载软件包 | 500 MB | 你有稳定高速的互联网,希望开始时下载较少 | [iso-cd][3] [torrent][4] |
| 完整的 CD 体积;带有 CD 1、2 和 3对于最基础的安装你只需要 CD 1 | 700 MB | 你希望下载基础的软件包,然后不使用互联网来安装它们 | [iso-cd][5] [torrent][6] |
| 完整的 DVD 体积;带有 DVD 1、2 和 3对于最基础的安装你只需要 DVD 1 | 5 GB | 你想先下载所有的东西,然后开始安装,这是离线安装的最理想方式 | [iso-dvd][7] [torrent][8] |
#### 非自由版本的 ISO 文件(带有专有软件包)
如果你有 Wi-Fi、蓝牙等特殊硬件 你可能会希望从下面的表中获取 “非自由” 版本的软件包。
| 类型 | 镜像种类 | **选择此 ISO 的情形** | ISO 下载链接amd64 |
| :- | :- | :- | :- |
| 非自由 | 完整的 CD 、DVD | 你想要减少工作量,并希望 Debian 能够在所有受支持的硬件上工作 | [cd-dvd][9] (然后转到 `*-nonfree` 目录) |
| 非自由 | 完整的 CD 、DVD<ruby>立付<rt>Live</rt></ruby>版) 独立的桌面环境软件包 | 你想要减少工作量Debian 能够工作,并且带有一个立付系统。立付系统也提供完整的安装 | [cd-dvd-live][9](然后转到 `*-nonfree` 目录) |
### 其它的架构
#### 针对 Debian 11 “Bullseye”
- [arm64][10]
- [armel][11]
- [armhf][12]
- [i386][13]
- mips (不可用)
- [mips64el][14]
- [mipsel][15]
- [ppc64el][16]
- [s390x][17]
所有的镜像,下载链接: [单击这里][18]。
### 较旧的版本Debian 10 “Buster”
如果你需要一些针对 Debian 10 “Buster” 的镜像,请访问这个 [页面][19]。
### 总结
对新用户来说,如果想要从官方网站上下载 Debian ISO 镜像,网站的信息可能多到无所适从。因此,我以一种恰当的格式总结下载链接。我希望这篇文章有助于你找到适合于你系统的目标 Debian ISO 镜像。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/download-debian-iso/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://cdimage.debian.org/cdimage/bookworm_di_alpha2/amd64/iso-cd/
[2]: https://cdimage.debian.org/cdimage/bookworm_di_alpha2/amd64/iso-dvd/
[3]: https://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/
[4]: https://cdimage.debian.org/cdimage/release/current/amd64/bt-cd/
[5]: https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/
[6]: https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/
[7]: https://cdimage.debian.org/cdimage/release/current/amd64/iso-dvd/
[8]: https://cdimage.debian.org/cdimage/release/current/amd64/bt-dvd/
[9]: https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/
[10]: http://ftp.debian.org/debian/dists/bullseye/main/installer-arm64/current/images/
[11]: http://ftp.debian.org/debian/dists/bullseye/main/installer-armel/current/images/
[12]: http://ftp.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/
[13]: http://ftp.debian.org/debian/dists/bullseye/main/installer-i386/current/images/
[14]: http://ftp.debian.org/debian/dists/buster/main/installer-mips64el/current/images/
[15]: http://ftp.debian.org/debian/dists/bullseye/main/installer-mipsel/current/images/
[16]: http://ftp.debian.org/debian/dists/bullseye/main/installer-ppc64el/current/images/
[17]: http://ftp.debian.org/debian/dists/bullseye/main/installer-s390x/current/images/
[18]: https://cdimage.debian.org/cdimage/
[19]: https://www.debian.org/releases/buster/debian-installer/
[0]: https://img.linux.net.cn/data/attachment/album/202303/26/101016gdf20utfqsu1215a.jpg

View File

@ -0,0 +1,354 @@
[#]: subject: "NixOS Series #4: Things To Do After Installing NixOS"
[#]: via: "https://itsfoss.com/things-to-do-after-installing-nixos/"
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15663-1.html"
NixOS 系列 #4:安装 NixOS 后要做的事
======
![][0]
安装之后,你会发现 NixOS 与通用的 Linux 发行版有很大的不同。
当然,作为 [高级 Linux 发行版][1]之一,大多数新用户对它并不熟悉。
如果你不知道 [为什么你应该使用 NixOS][2],并且出于好奇而尝试它,那么在继续进行之前,知道它是为谁准备的至关重要。
虽然我假设你已经安装了这个发行版,但如果你是第一次使用,我建议先 [在虚拟机上安装 NixOS][3]。
### 1、更新软件包
即使你使用最新的 ISO 进行安装,也总是会有更新的。那么为什么不从更新软件包开始呢?
要升级软件包,首先,你必须在添加的频道中检查是否有更新:
```
nix-channel --update
```
然后,使用下面的命令来安装这些更新(如果有的话):
```
sudo nixos-rebuild switch --upgrade
```
这就行了!它将处理其余的事情。
### 2、在 NixOS 中改变主机名
如果你尝试用传统的方法 [改变主机名][4](使用 `hostnamectl` 命令),会出现以下错误:
![在 NixOS 中改变主机名的错误][5]
在 NixOS 中,你可以用它的主配置文件轻松地改变主机名。使用如下命令:
```
sudo nano /etc/nixos/configuration.nix
```
在这个配置文件中,寻找以下一行:
```
networking.hostName = "nixos"
```
然后把它改成:
```
networking.hostName = "Your_Hostname"
```
例如,我把我的主机名改为 `itsFOSS`
```
networking.hostName = "itsFOSS"
```
![在 NixOS 中改变主机名][6]
现在,[保存更改并退出 nano][7] 文本编辑器。
为了使你对主机名的修改生效,执行以下命令:
```
sudo nixos-rebuild switch
```
最后,重新打开终端,主机名的变化应该反映出来。
### 3、设置 Flatpak
我知道你可能在想什么。Nix 软件包管理器已经提供了大量的软件包。那么,为什么你需要 Flatpak 呢?
安装你所需要的东西对于第一次使用的人来说可能有点费时。所以Flatpak 应该能给你带来方便。
[设置 Flatpak][8] 与你在 Ubuntu 上做的不一样。
要设置 Flatpak你必须对 `configuration.nix` 文件进行修改,可以通过以下方式访问该文件:
```
sudo nano /etc/nixos/configuration.nix
```
[在 nano 中移动到最后一行][9],在 `}` 前添加以下一行:
```
services.flatpak.enable = true
```
![在 NixOS 上设置 Flatpak][10]
`Ctrl + O` 保存更改,按回车键,按 `Ctrl + X` 退出。
接下来,使用以下命令重建并切换到新的配置文件:
```
sudo nixos-rebuild switch
```
最后,使用下面的命令将 Flathub 软件库添加到系统中:
```
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
```
想知道到底什么是 Flatpak 包吗?你可以参考我们关于它的文章:
> **[什么是 Flatpak你需要知道的关于这个通用包装系统的一切重要信息][23]**
### 4、启用垃圾收集
NixOS 以其不可改变性而闻名,这是有充分理由的。
每当你升级一个软件包时,旧的软件包不会被删除。只是指向旧包的符号链接将被指向最新的版本。
而这样做,你的系统中会积累下不必要的垃圾。
但是,删除每一个旧世代将违背 NixOS 的初衷。
所以,在这种情况下,你可以将你的系统配置为每周删除垃圾包。
要做到这一点,首先,打开 NixOS 配置文件:
```
sudo nano /etc/nixos/configuration.nix
```
并在配置文件末尾的 `}` 前添加以下一行:
```
# Automatic Garbage Collection
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
```
![在 NixOS 中启用自动垃圾收集][11]
保存修改并退出 nano 文本编辑器。
为了激活垃圾收集,重建并切换到新的配置文件:
```
sudo nixos-rebuild switch
```
如果你不确定垃圾收集器是否在后台正常运行,你可以用以下命令列出活动的计时器:
```
systemctl list-timers
```
![][12]
正如你所看到的Nix 垃圾收集器正在如期运行,并显示距离下次清理还有 5 天。
### 5、安装你喜欢的软件
我是说这是我们使用电脑的唯一原因 —— “为了使用我们最喜欢的软件”,如果还不是,我们就把它变成现实!
寻找软件包的最好地方是 [Nix 软件包搜索][13],可以使用你喜欢的任何浏览器访问。
- 搜索软件包
- 选择软件包
- 点击 “nix-env” 并复制给定的 NixOS 的命令
- 执行该命令,就可以了
你可以查看我们的 [NixOS 软件包管理][14] 指南,了解所有的细节。
让我在这里给你一个简单的回顾。例如,在这里,我想安装 Librewolf所以我采用了以下方法
![搜索 NixOS 的软件包][15]
**但如果你想安装 SSH 或 Plex 等服务,上述方法就不能用了**。
为此,你得查看位于页面顶部的 “<ruby>NixOS 选项<rt>NixOS options</rt></ruby>”。
因此,假设我想安装 OpenSSH那么我必须按照给定的步骤进行
- 进入 “NixOS 选项”。
- 搜索服务的名称
- 获取服务的名称并将其粘贴到 `configuration.nix` 中,将其值改为 `true`
![搜索 NixOS 的服务][16]
```
services.openssh.enable = true
```
![在 NixOS 上启用 OpenSSH][17]
在配置文件中加入这一行后,重建服务:
```
sudo nixos-rebuild switch
```
### 6、在 NixOS 中启用自动更新(可选)
一些用户喜欢启用自动更新功能,而另一些用户则可以在他们方便的时候更新软件包。
所以这完全取决于你。
**要启用自动更新**,首先打开 `configuration.nix` 文件:
```
sudo nano /etc/nixos/configuration.nix
```
接下来,在配置文件的末尾,在 `}` 之前添加以下一行:
```
# Auto system update
system.autoUpgrade = {
enable = true
};
```
![在 NixOS 中启用自动系统更新][18]
保存修改并退出 nano。
要启用自动更新,你必须用以下方法重建并切换到该文件:
```
sudo nixos-rebuild switch
```
你也可以用下面的命令检查 NixOS 的升级定时器:
```
systemctl list-timers
```
![NixOS 的自动升级定时器][19]
正如你所看到的,`nixos-upgrade.service` 正在后台如期运行!
### 7、减少交换度
如果你正在利用交换分区,你可能想减少交换度。
交换度只不过是你想要多积极地使用交换分区(或内存)的数值,其范围从 0 到 100。
交换度越小你的系统就会越多地使用物理内存RAM而交换分区只不过是你的存储驱动器的一部分而已。
另外,存储驱动器的速度相对比内存慢,所以如果可能的话,你应该减少交换度。
要检查你的系统的默认交换度,请使用以下方法:
```
cat /proc/sys/vm/swappiness
```
![检查 Linux 系统的交换度][20]
而对于大多数 Linux 发行版,它被设置为 `60`
我建议你把这个值降低到 `10`
要做到这一点,首先,用以下命令打开配置文件:
```
sudo nano /etc/nixos/hardware-configuration.nix
```
并在 `}` 之前的行末添加以下一行:
```
boot.kernel.sysctl = { "vm.swappiness" = 10;}
```
![减少 NixOS 中的交换度][21]
保存修改并退出文本编辑器。
现在,重建配置并使用下面的方法切换到它:
```
sudo nixos-rebuild switch
```
现在,你可以再次检查交换度,它应该反映出变化:
```
cat /proc/sys/vm/swappiness
```
![减少 NixOS 中的交换度][22]
就这些了。
### 总结
如果你在第一次安装 NixOS 后马上遵循这些要点,你应该得到一个良好的用户体验。
当然,根据你的要求,还可以有一些其他的东西。但是,我认为上面提到的事情是最基本或最常见的事情。
在本系列的下一部分,我将讨论在 NixOS 上设置家庭管理器,这对有多个用户的系统应该是有帮助的。
💬 安装NixOS后你首先做什么让我知道你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/things-to-do-after-installing-nixos/
作者:[Sagar Sharma][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sagar/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/advanced-linux-distros/
[2]: https://linux.cn/article-15606-1.html
[3]: https://linux.cn/article-15624-1.html
[4]: https://itsfoss.com/change-hostname-ubuntu/
[5]: https://itsfoss.com/content/images/2023/02/error-changing-hostname-in-nixos.png
[6]: https://itsfoss.com/content/images/2023/02/change-hostname-in-NixOS.png
[7]: https://linuxhandbook.com/nano-save-exit/?ref=its-foss
[8]: https://itsfoss.com/flatpak-guide/
[9]: https://linuxhandbook.com/beginning-end-file-nano/?ref=its-foss
[10]: https://itsfoss.com/content/images/2023/02/setup-flatpak-on-nixos.png
[11]: https://itsfoss.com/content/images/2023/02/enable-automatic-garbage-collection-in-NixOS.png
[12]: https://itsfoss.com/content/images/2023/02/list-active-timers-in-nixos.png
[13]: https://search.nixos.org/packages?ref=its-foss
[14]: https://linux.cn/article-15645-1.html
[15]: https://itsfoss.com/content/images/2023/02/search-packages-for-nixos.png
[16]: https://itsfoss.com/content/images/2023/02/Search-the-service-for-nixos.png
[17]: https://itsfoss.com/content/images/2023/02/enable-openssh-on-nixos.png
[18]: https://itsfoss.com/content/images/2023/02/enable-auto-system-update-in-nixos.png
[19]: https://itsfoss.com/content/images/2023/02/auto-upgrade-timer-in-nixos.png
[20]: https://itsfoss.com/content/images/2023/02/check-swapiness-of-linux-system.png
[21]: https://itsfoss.com/content/images/2023/02/reduce-swapiness-in-nixos.png
[22]: https://itsfoss.com/content/images/2023/02/reduce-swapiness-in-NixOS.png
[23]: https://itsfoss.com/what-is-flatpak/
[0]: https://img.linux.net.cn/data/attachment/album/202303/26/142500uzc095szl064s9xx.jpg

View File

@ -0,0 +1,325 @@
[#]: subject: "How to Install Kubernetes Cluster Using Kubespray"
[#]: via: "https://www.linuxtechi.com/install-kubernetes-using-kubespray/"
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15675-1.html"
使用 Kubespray 安装 Kubernetes 集群
======
![][0]
> 你是否正在寻找有关如何使用 Kubespray 安装 Kubernetesk8s的简单指南
此页面上的分步指南将向你展示如何在 Linux 系统上使用 Kubespray 安装 Kubernetes 集群。
Kubespray 是一个自由开源的工具,它提供了 Ansible <ruby>剧本<rt>playbook</rt></ruby> 来部署和管理 Kubernetes 集群。它旨在简化跨多个节点的 Kubernetes 集群的安装过程,允许用户快速轻松地部署和管理生产就绪的 Kubernetes 集群。
它支持一系列操作系统,包括 Ubuntu、CentOS、Rocky Linux 和 Red Hat Enterprise LinuxRHEL它可以在各种平台上部署 Kubernetes包括裸机、公共云和私有云。
在本指南中,我们使用以下实验室:
- Ansible 节点Kubespray 节点):最小安装的 Ubuntu 22.04 LTS192.168.1.240
- 3 个控制器节点:最小安装的 Rocky Linux 9192.168.1.241/242/243
- 2 个工作节点:最小安装的 Rocky Linux 9192.168.1.244/245
### Kubespray 的最低系统要求
- 主节点1500 MB RAM、2 个 CPU 和 20 GB 可用磁盘空间
- 工作节点1024 MB、2 个 CPU、20 GB 可用磁盘空间
- Ansible 节点1024 MB、1 个 CPU 和 20 GB 磁盘空间
- 每个节点上的互联网连接
- 拥有 sudo 管理员权限
事不宜迟,让我们深入了解安装步骤。
### 步骤 1配置 Kubespray 节点
登录到你的 Ubuntu 22.04 系统并安装 Ansible。运行以下一组命令
```
$ sudo apt update
$ sudo apt install git python3 python3-pip -y
$ git clone https://github.com/kubernetes-incubator/kubespray.git
$ cd kubespray
$ pip install -r requirements.txt
```
验证 Ansible 版本,运行:
```
$ ansible --version
```
![][1]
创建主机清单,运行以下命令,不要忘记替换适合你部署的 IP 地址:
```
$ cp -rfp inventory/sample inventory/mycluster
$ declare -a IPS=(192.168.1.241 192.168.1.241 192.168.1.242 192.168.1.243 192.168.1.244 192.168.1.245)
$ CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
```
修改清单文件,设置 3 个控制节点和 2 个工作节点:
```
$ vi inventory/mycluster/hosts.yaml
```
![][2]
保存并关闭文件。
查看并修改文件 `inventory/mycluster/group_vars/k8s_cluster/k8s-cluster.yml` 中的以下参数:
```
kube_version: v1.26.2
kube_network_plugin: calico
kube_pods_subnet: 10.233.64.0/18
kube_service_addresses: 10.233.0.0/18
cluster_name: linuxtechi.local
```
![][3]
要启用 Kuberenetes 仪表板和入口控制器等插件,请在文件 `inventory/mycluster/group_vars/k8s_cluster/addons.yml` 中将参数设置为已启用:
```
$ vi inventory/mycluster/group_vars/k8s_cluster/addons.yml
```
```
dashboard_enabled: true
ingress_nginx_enabled: true
ingress_nginx_host_network: true
```
保存并退出文件。
### 步骤 2将 SSH 密钥从 Ansible 节点复制到所有其他节点
首先在你的 Ansible 节点上为你的本地用户生成 SSH 密钥:
```
$ ssh-keygen
```
使用 `ssh-copy-id` 命令复制 SSH 密钥:
```
$ ssh-copy-id sysops@192.168.1.241
$ ssh-copy-id sysops@192.168.1.242
$ ssh-copy-id sysops@192.168.1.243
$ ssh-copy-id sysops@192.168.1.244
$ ssh-copy-id sysops@192.168.1.245
```
还要在每个节点上运行以下命令:
```
$ echo "sysops ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/sysops
```
### 步骤 3禁用防火墙并启用 IPV4 转发
要在所有节点上禁用防火墙,请从 Ansible 节点运行以下 `ansible` 命令:
```
$ cd kubespray
$ ansible all -i inventory/mycluster/hosts.yaml -m shell -a "sudo systemctl stop firewalld && sudo systemctl disable firewalld"
```
运行以下 `ansible` 命令以在所有节点上启用 IPv4 转发和禁用交换:
```
$ ansible all -i inventory/mycluster/hosts.yaml -m shell -a "echo 'net.ipv4.ip_forward=1' | sudo tee -a /etc/sysctl.conf"
$ ansible all -i inventory/mycluster/hosts.yaml -m shell -a "sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab && sudo swapoff -a"
```
### 步骤 4启动 Kubernetes 部署
现在,我们都准备好开始 Kubernetes 集群部署,从 Ansible 节点运行下面的 Ansible 剧本:
```
$ cd kubespray
$ ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml
```
![][4]
现在监控部署,可能需要 20 到 30 分钟,具体取决于互联网速度和硬件资源。
部署完成后,我们将在屏幕上看到以下输出:
![][5]
很好,上面的输出确认部署已成功完成。
### 步骤 5访问 Kubernetes 集群
登录到第一个主节点,切换到 root 用户,在那里运行 `kubectl` 命令:
```
$ sudo su -
# kubectl get nodes
# kubectl get pods -A
```
输出:
![][6]
完美,上面的输出确认集群中的所有节点都处于就绪状态,并且所有命名空间的 <ruby>容器荚<rt>Pod</rt></ruby> 都已启动并正在运行。这表明我们的 Kubernetes 集群部署成功。
让我们尝试部署基于 Nginx 的部署并将其公开为节点端口,运行以下 `kubectl` 命令:
```
$ kubectl create deployment demo-nginx-kubespray --image=nginx --replicas=2
$ kubectl expose deployment demo-nginx-kubespray --type NodePort --port=80
$ kubectl get deployments.apps
$ kubectl get pods
$ kubectl get svc demo-nginx-kubespray
```
以上命令的输出:
![][7]
现在尝试使用工作节点的 IP 地址和节点端口30050访问此 Nginx 应用。
使用以下 `curl` 命令或 Web 浏览器访问此应用。
```
$ curl 192.168.1.245:30050
```
或者,
![][8]
完美,这证实了应用可以在我们的集群之外访问。
### 步骤 6Kubernetes 仪表板GUI
要访问 Kubernetes 仪表板,让我们首先创建服务帐户并分配管理员权限,以便它可以使用令牌访问仪表板。
在 kube-system 命名空间中创建名为 “admin-user” 的服务帐户:
```
$ vi dashboard-adminuser.yml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
```
保存并关闭文件。
```
$ kubectl apply -f dashboard-adminuser.yml
serviceaccount/admin-user created
```
创建集群角色绑定:
```
$ vi admin-role-binding.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kube-system
```
保存并退出文件。
```
$ kubectl apply -f admin-role-binding.yml
clusterrolebinding.rbac.authorization.k8s.io/admin-user created
```
现在,为管理员用户创建令牌:
```
$ kubectl -n kube-system create token admin-user
```
![][9]
复制此令牌并将其放在安全的地方,因为我们将使用令牌登录 Kubernetes 仪表板。
使用以下 `ssh` 命令从你的系统连接到第一个主节点:
```
$ ssh -L8001:localhost:8001 sysops@192.168.1.241
```
注意:替换适合你环境的 IP 地址。
登录后,切换到 root 用户并运行 `kubectl proxy` 命令:
```
$ sudo su -
# kubectl proxy
Starting to serve on 127.0.0.1:8001
```
![][10]
打开系统的网络浏览器,如下设置代理:
![][11]
完成代理设置后,将以下网址粘贴到浏览器中:
```
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#/login
```
![][12]
选择令牌登录并粘贴你在上面为管理员用户生成的令牌,然后单击“<ruby>登录<rt>Sign in</rt></ruby>”。
![][13]
这就是本指南的全部内容,我希望你能从中找到有用的信息。请在下面的评论部分中发表你的疑问和反馈。
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/install-kubernetes-using-kubespray/
作者:[Pradeep Kumar][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lkxed/
[1]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Ansible-Version-Kubespray-Ubuntu.png
[2]: https://www.linuxtechi.com/wp-content/uploads/2023/03/K8s-inventory-file-kubespray.png
[3]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Edit-Cluster-yaml-kubespray.gif
[4]: https://www.linuxtechi.com/wp-content/uploads/2023/03/k8s-deployment-ansible-playbook-kubespray-1024x673.png?ezimgfmt=ng:webp/ngcb22
[5]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Kubernetes-deployment-successfull-kubespray-1024x446.png?ezimgfmt=ng:webp/ngcb22
[6]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Kubectl-Commands-k8s-kubespray-1024x856.png?ezimgfmt=ng:webp/ngcb22
[7]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Demo-Nginx-Deployment-Kubespray-kubernetes.png
[8]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Nginx-Default-Page-Kubespray-Demo-Application.png
[9]: https://www.linuxtechi.com/wp-content/uploads/2023/03/create-token-admin-user-k8s-dashboard.png
[10]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Ssh-Tunneling-master-node-kubernetes.png
[11]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Proxy-Settings-Kubenetes-Dashbaord-kubespray.png
[12]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Kubernetes-Dashboard-Login-Page-KubeSpray.png
[13]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Kubernetes-Dashboard-Home-Page-Kubespray.png
[0]: https://img.linux.net.cn/data/attachment/album/202303/30/074513iy2it365a3fti2f2.jpg

View File

@ -0,0 +1,70 @@
[#]: subject: "How I destroyed my Raspberry Pi"
[#]: via: "https://opensource.com/article/23/3/how-i-destroyed-my-raspberry-pi"
[#]: author: "Stephan Avenwedde https://opensource.com/users/hansic99"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15646-1.html"
我是如何毁掉我的树莓派的
======
![][0]
> 多测量几次总比测量一次好。我掉到坑里,希望你可以不用。
我想写一篇文章来演示“如何使用树莓派实现莫某的自动化”,或围绕树莓派的其他一些有趣、好奇或有用的应用。正如你可能从标题中意识到的那样,我不能再提供这样的文章了,因为我毁了我心爱的树莓派。
树莓派是每个技术爱好者办公桌上的标准设备。因此,大量教程和文章告诉你可以用它做什么。这篇文章反而涵盖了阴暗面:我描述了你最好不要做的事情!
### 电缆颜色
在谈到实际的破坏点之前,我想提供一些背景。在房屋内外进行电气工作时,你必须处理不同颜色的电缆。在德国,每栋房子都连接到三相交流电网,你通常会发现以下电缆颜色:
- 零线:蓝色
- PE地线黄绿色
- L1火线 1棕色
- L2火线 2黑色
- L3火线 3灰色
例如给灯接线时你接零线N蓝色和火线L有 1/3 的机会是棕色),它们之间的电压为 230V 交流电。
### 连接树莓派
今年早些时候,我写了一篇关于 [OpenWrt家用路由器固件的开源替代品][1] 的文章。在文章中,我使用了 TP-link 路由器设备。但是,最初的计划是使用我的树莓派 4。
![OpenWrt and Raspberry Pi comparison][2]
我的想法是构建一个旅行路由器,我可以将其安装在我的大篷车中以改善露营地的互联网连接(我是那种离不开互联网的露营者)。为此,我在我的树莓派中添加了一个单独的 USB 无线网卡以连接第二个 Wifi 天线并安装了 [OpenWrt][3]。此外,我添加了一个 12V 至 5V DC/DC 转换器来连接大篷车中的 12V 接线。我用桌上的 12V 汽车电池测试了这个设置,它按预期工作。一切设置和配置完成后,我开始将其安装到我的大篷车中。
在我的大篷车里,我找到了一根蓝色和一根棕色的电线,将它与 12V 至 5V DC/DC 转换器相连,将保险丝放回,然后……
![DC converter device][4]
这个芯片,自己爆开了,它才是真正的降压变压器。我非常自信地认为蓝线是在 0V 电位上,棕色的是在 12V 上,我甚至没有测量。后来我了解到,蓝色的线是在 12V 上,而棕色的线是接地(这在汽车电子产品中很常见)。
### 总结
自从这次事故后,我的树莓派就再也启动不起来了。由于树莓派的价格飞涨,我不得不寻找替代品。幸运的是,我遇到了 TP-Link 旅行路由器,它也可以运行 Open-WRT 并且可以令人满意地完成它的工作。
最后:多测量几次总比测量一次好。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/how-i-destroyed-my-raspberry-pi
作者:[Stephan Avenwedde][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/hansic99
[b]: https://github.com/lkxed/
[1]: https://opensource.com/article/22/7/openwrt-open-source-firmware
[2]: https://opensource.com/sites/default/files/2023-03/OpenWrt_Comparison_RaspberryPi.jpg
[3]: https://openwrt.org/
[4]: https://opensource.com/sites/default/files/2023-03/dc_converter.png
[0]: https://img.linux.net.cn/data/attachment/album/202303/21/154709mhtffmtaze85utjb.jpg

View File

@ -0,0 +1,112 @@
[#]: subject: "Kali Linux Introduces “Kali Purple” for Defensive Security Hardening"
[#]: via: "https://debugpointnews.com/kali-linux-2023-1/"
[#]: author: "arindam https://debugpointnews.com/author/dpicubegmail-com/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15636-1.html"
Kali Linux 推出用于防御性安全加固的 “Kali Purple”
======
> Kali Linux 2023.1 发布了重大更新,并引入了一个新的变体 “Kali Purple”。
![Kali Linux 2023.1 桌面][1]
在 Kali Linux 的 10 周年纪念该团队为你准备了一些好东西。Kali Linux 2023.1 是 Kali Linux 的常规软件包更新,它带来了最新的桌面环境和主线内核更新。
### Kali Linux 2023.1 推出 Kali Purple
这个版本的主要亮点是 [Kali Purple][2],这是 Kali Linux 的一个新变体,带有 “防御性安全” 工具。Kali 团队目前正在将其作为技术预览版发布。
防御性安全软件可以实现各方面的安全加固,如漏洞扫描、事件跟踪和响应、数据包捕获、入侵检测等。现在你可以使用 Kali Purple 为你的应用程序或企业内置的所有工具。
![你可以在安装过程中选择防卫包][3]
Kali Purple 带来了 100 多个防御工具、文档、用于自动攻击脚本构建的 Kali CoPilot 以及更多工具。
- [Arkime][4] - 完整的数据包捕获和分析
- [CyberChef][5] - 网络瑞士军刀
- Elastic Security - 安全信息和事件管理
- [GVM][6] - 漏洞扫描器
- [TheHive][7] - 事件响应平台
- Malcolm - 网络流量分析工具套件
- [Suricata][8] - 入侵检测系统
- [Zeek][9] -(另一个)入侵检测系统
此外,为了与 美国《国家标准和技术研究所关键基础设施网络安全NIST CSF》的指导方针保持一致为你配置了单独的菜单项目。它包括单独的应用类别 - 识别、保护、检测、响应和恢复。
![根据 CIST CSF 准则的新菜单组][10]
此外,还为 Kali Purple 创建了一个单独的 Discord 频道,用于合作和为社区提供额外的帮助。
### Python 中的 Pip 变化
Python 的 `pip` 命令在即将发布的Debian 12 Bookworm 版本中正在发生变化。`pip` 命令用于安装 Python 模块。由于这些模块是用 `pip` 从外部安装的,它可能会破坏现有的 Debian 系统。
因此,从 Debian 12 开始,如果你试图用 `pip` 安装任何模块,你应该会得到一个 “<ruby>外部管理的环境<rt>externally-managed-environment</rt></ruby>”的错误。如下:
![你可以在 Kali 和 Debian 中使用 pip 进行安装][11]
Kali Linux 团队从这个版本开始提供一个补丁,使你可以使用 `pip` 安装任何模块。但这只是暂时的解决方案,直到 Debian 12 稳定版。
所以,如果你是一个在 Kali Linux或在 Debian中使用 Python 环境的开发者,你肯定应该计划使用下面的 `apt` 命令来部署这些模块:
```
apt install python3-numpy
```
### 桌面环境和其他更新
默认桌面 Xfce 现在采用了 Xfce 4.18 版本,它带来了大量的功能,包括分割视图、图像预览和 Thunar 文件管理器中的其他功能。另外KDE Plasma 版现在在 Kali Linux 2023.1 中的版本是 5.27。
Xfce 版的默认主题得到了改进,具有令人惊叹的外观;许多新的壁纸也包含在这个版本中。
最后,主线内核 6.1 现在可以在这个版本中使用,提供了最新的硬件、 CPU、GPU 和其他支持。
### 下载
如果你已经在运行 Kali Linux只需运行系统升级就可以得到这个版本
```
sudo apt update && sudo apt upgrade -y
```
对于新的下载,请访问下面的页面来获取 ISO。
> **[下载 Kali Linux][12]**
如果你想试试 Kali Purple请访问下面的页面
> **[下载 Kali Purple ISO][13]**
参考自 [发布公告][14]。
--------------------------------------------------------------------------------
via: https://debugpointnews.com/kali-linux-2023-1/
作者:[arindam][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://debugpointnews.com/author/dpicubegmail-com/
[b]: https://github.com/lkxed/
[1]: https://debugpointnews.com/wp-content/uploads/2023/03/Kali-Linux-2023.1-Desktop.jpg
[2]: https://gitlab.com/kalilinux/kali-purple/documentation/-/wikis/home
[3]: https://debugpointnews.com/wp-content/uploads/2023/03/You-have-the-option-to-choose-defensive-packages-during-installation.jpg
[4]: https://pkg.kali.org/pkg/arkime
[5]: https://pkg.kali.org/pkg/cyberchef
[6]: https://www.kali.org/tools/gvm/
[7]: https://pkg.kali.org/pkg/thehive
[8]: https://pkg.kali.org/pkg/suricata
[9]: https://pkg.kali.org/pkg/zeek
[10]: https://debugpointnews.com/wp-content/uploads/2023/03/New-menu-groups-as-per-CISF-NSF-guideline.jpg
[11]: https://debugpointnews.com/wp-content/uploads/2023/03/You-can-install-using-pip-in-Kali-and-Debian.jpg
[12]: https://www.kali.org/get-kali/#kali-installer-images
[13]: https://cdimage.kali.org/kali-2023.1/kali-linux-2023.1-installer-purple-amd64.iso
[14]: https://www.kali.org/blog/kali-linux-2023-1-release/

View File

@ -0,0 +1,128 @@
[#]: subject: "Input Function in Python: Concepts and Examples"
[#]: via: "https://www.debugpoint.com/input-function-python/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15660-1.html"
Python 中的输入函数:概念和示例
======
> 在这篇文章中,我将通过一些通俗易懂的例子来解释 Python 的 Input 函数的基础知识。
![][1]
Python 是世界上最流行的编程语言之一广泛应用于各种应用程序中。Python 中的一个基本概念是 `input()` 函数,它允许用户通过提供输入值与程序进行交互。
让我们看看 `input()` 函数是如何工作的,以及如何在 Python 程序中有效地使用它。
在开始之前,我希望你已经安装了 Python 并设置了一个基本的编辑器。如果没有,请参考我的以下指南:
- [如何在 Ubuntu 等 Linux 上安装 Python 3.11][2]
- [如何在 Windows 上安装 Python][3]
- [如何为 Python 设置 IDLE 编辑器][4]
### Python Input 函数
Python 中的 `input()` 函数用于接受用户输入的字符串。它提示用户输入一个值并等待用户提供输入。然后将用户的输入作为字符串存储在变量中,稍后可以在程序中使用。
#### 句法
```
input("your message to user")
```
当你运行 `input()` 函数时,它会向用户显示消息并 _等待_ 输入。显示光标等待。当用户输入并按下回车键,`input()` 函数就会读取用户的输入。该值存储在你指定的变量中。
让我们看几个例子。
### 示例 1简单的 input() 函数用法
以下代码片段接受输入并显示带有附加字符串的输出:
```
your_name = input("Enter your name:")
print("Hello " + your_name)
```
输出:
```
Enter your name:arindamHello arindam
```
![Python 输入函数:一个简单的例子][5]
### 示例 2以整数和浮点数作为输入
在使用 `input()` 函数时,你还可以在运行时使用 `int()``float()` 将输入转换。这是一个例子:
```
no_of_books = int(input("Enter total books ordered:"))
print ("Total number of books:", no_of_books)
price_of_each_book = float(input("Enter unit price:"))
print ("Total price:", no_of_books * price_of_each_book)
```
输出:
```
Enter total books ordered:5
Total number of books: 5
Enter unit price:10.1
Total price: 50.5
```
### 示例 3连接列表
你还可以使用其他函数(例如列表)来接受一组值并将它们转换为 Python 中的 [列表][6]。这是一个接受输入并将其转换为列表的示例。然后使用另一组值并附加到第一个列表:
```
# 获取第一个列表的输入
list_1 = list(input("Enter numbers for list 1:"))
# 获取第二个列表的输入
list_2 = list(input("Enter some letters for list 2:"))
# 循环遍历第二个列表并添加到第一个列表
for j in list_2:
list_1.append(j)
# 打印修改后的第一个列表
print(list_1)
```
输出:
```
Enter numbers for list 1:1234
Enter some letters for list 2:ABCD
['1', '2', '3', '4', 'A', 'B', 'C', 'D']
```
### 总结
我希望这个简单的指南通过几个示例阐明了 `input()` 函数。对于简单的场景,它是一个强大的功能,可以从标准输入中接受值。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/input-function-python/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/wp-content/uploads/2023/03/pyinput.jpg
[2]: https://linux.cn/article-15230-1.html
[3]: https://linux.cn/article-15480-1.html
[4]: https://linux.cn/article-15622-1.html
[5]: https://www.debugpoint.com/wp-content/uploads/2023/03/Python-Input-function-a-simple-example.jpg
[6]: https://docs.python.org/3/library/stdtypes.html?highlight=list#lists

View File

@ -0,0 +1,145 @@
[#]: subject: "How to know if You are Behind a Proxy Server?"
[#]: via: "https://itsfoss.com/check-proxy-server/"
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15657-1.html"
如何知道你是否使用了代理服务器?
======
![][0]
什么是代理?
代理是充当客户端和另一台服务器之间的中介的服务器或软件应用。它充当客户端和互联网之间的网关,允许用户访问在线资源,同时隐藏他们的身份、位置和其他个人信息。
代理通常用于增强安全性和隐私,并为你的网络添加过滤器/防火墙。
有几种类型的代理,如 HTTP 代理、SOCKS 代理、透明代理等。
除非你在透明代理后面,否则检查起来毫不费力。在这里,我将讨论检测透明代理和常用代理的方法。
### 如何检查你是否在透明代理后面
虽然每种类型的代理都有其特性和功能,但如果它是透明代理,你将无法在客户端的 PC 上检测到它。这是因为透明代理在后台静默运行,拦截所有流量而不修改它。
有时,可能是你的互联网服务提供商和内容交付网络使用它们来缓存资源的副本以节省带宽或只是为了监视/过滤网络。
有几种方法可以检查你是否在透明代理后面:
- **通过某些在线 IP 检测/检查网站获得的 IP 地址可能与你的计算机或设备的 IP 地址不匹配**。因为代理服务器正在拦截你的流量并将其与 IP 地址一起发送出去。
- **检查你的网络设置以查看是否配置了代理服务器。**
- **借助一些在线代理检测工具。**
- **连接到你知道不存在的服务器。** 如果网页上显示的错误看起来与平时不同,你可能使用了代理。
无论你喜欢与否,你始终可以使用 [VPN 服务][1] 绕过透明代理。
### 如何检查你是否在 Ubuntu 上使用代理
Ubuntu 或任何其他 Linux 发行版提供了多种检查方法。此处使用运行 GNOME 的 Ubuntu 22.10。
#### 使用 GNOME 设置
这是直接的 GUI 方式。打开 GNOME <ruby>设置<rt>Settings</rt></ruby> 并转到 “<ruby>网络<rt>Networks</rt></ruby>” 选项卡,然后按旁边的齿轮图标。
![Select the gear icon adjacent to the Network proxy section][2]
它应该默认 <ruby>禁用<rt>Disabled</rt></ruby>
如果你在代理后面,你可以在这里看到不同的状态。在代理设置中,你可以看到,我在这里使用了代理(手动配置)。
![Proxy details in GNOME Settings][3]
可以使用 GNOME 桌面中的 `gsettings` 命令更改相同的代理状态。
```
gsettings set org.gnome.system.proxy mode 'none'
```
你可以将 `none` 替换为 `auto``manual`。请记住,此设置是临时的,仅适用于当前用户。
#### 使用命令行
你可以通过命令行以多种方式获取代理的状态。
##### 通过列出关联的环境变量获取代理的状态
打开终端并运行以下任一命令:
```
env | grep -i proxy
```
```
cat /etc/environment | grep -i proxy
```
```
set | grep -i proxy
```
![Using set command to check Proxy variables][4]
空输出意味着没有配置代理。否则,它将打印相关的环境变量。
> 🚧 请注意,如果你将代理设置为环境变量,这将起作用。
或者,你可以回显每个代理变量以检查是否设置了特定的代理变量。
以下是你可以在终端中输入的内容:
```
echo $http_proxy
```
##### 使用 nmcli 命令检查
打开终端并输入:
```
nmcli connection show
```
![List all the connections using nmcli command][5]
这将列出你的连接和关联的 UUID 编号。记下要检查的连接的 UUID 编号。然后使用命令:
```
nmcli connection show <UUID or name> | grep -i "proxy"
```
这将列出变量,你可以在其中记下代理服务器和端口。
![Proxy details using nmcli command][6]
### 总结
我希望本指南可以帮助你了解你是否在使用代理。
我必须提一下,**并非所有代理配置都是恶意的。**
但是,了解你的系统是否配置了代理很重要。
--------------------------------------------------------------------------------
via: https://itsfoss.com/check-proxy-server/
作者:[Sreenath][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sreenath/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/best-vpn-linux/
[2]: https://itsfoss.com/content/images/2023/02/select-the-gear-icon-adjacent-to-proxy.png
[3]: https://itsfoss.com/content/images/2023/02/Proxy-in-GNOME-settings.png
[4]: https://itsfoss.com/content/images/2023/02/set_grep_proxy.png
[5]: https://itsfoss.com/content/images/2023/02/nmcli-connection-show.png
[6]: https://itsfoss.com/content/images/2023/02/proxy-using-nmcli.png
[0]: https://img.linux.net.cn/data/attachment/album/202303/24/174021wkdzn81kvtnngzaw.jpg

View File

@ -0,0 +1,67 @@
[#]: subject: "How to set up your own open source DNS server"
[#]: via: "https://opensource.com/article/23/3/open-source-dns-server"
[#]: author: "Amar Gandhi https://opensource.com/users/amar1723"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15672-1.html"
如何设置自己的保护隐私的 DNS 服务器
======
![][0]
> 通过开源项目 AdGuard Home 运行你自己的 DNS 服务器来控制你的互联网隐私。
域名服务器DNS将域名如 example.com与 IP 地址(如 93.184.216.34)相关联。这就是当你输入 URL 或搜索引擎返回 URL 供你访问时你的网络浏览器如何知道在世界的哪个地方寻找数据。DNS 为互联网用户提供了极大的便利,但也并非没有缺点。例如,付费广告会出现在网页上,因为你的浏览器会自然的使用 DNS 来解析这些广告在互联网上“存在”的位置。同样,跟踪你在线活动的软件通常由通过 DNS 解析的服务启用。你不想完全关闭 DNS因为它非常有用。但是你可以运行自己的 DNS 服务,以便更好地控制它的使用方式。
我相信运行自己的 DNS 服务器至关重要,这样你就可以阻止广告并保持你的浏览隐私,远离试图分析你的在线交互的提供商。我过去用过 [Pi-hole][1],今天仍然推荐它。然而,最近,我一直在我的网络上运行开源项目 [AdGuard Home][2]。我发现它有一些值得探索的独特功能。
### AdGuard Home
在我使用过的开源 DNS 软件中,[AdGuard Home][2] 是最容易设置和维护的。你可以在一个项目中获得许多 DNS 解析解决方案,例如 DNS over TLS、DNS over HTTPS 和 DNS over QUIC。
你可以使用一个脚本将 AdGuard 设置为容器或本地服务:
```
$ curl -s -S -L \
https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh
```
查看这个脚本以便了解它的作用。了解了它的工作过程后,再运行它:
```
$ sh ./install.sh
```
我最喜欢 AdGuard Home 的一些功能:
- 一个简单的管理界面
- 使用 AdGuard 阻止列表来阻止广告和恶意软件
- 单独配置网络上每个设备的选项
- 强制在特定设备上进行安全搜索
- 为管理界面设置 HTTPS这样与它的远程交互是完全加密的
我发现 AdGuard Home 为我节省了时间。它的黑名单比 Pi-hole 上的黑名单更强大。你可以快速轻松地将其配置为 DNS over HTTPS。
### 没有更多的恶意软件
恶意软件是你计算机上不需要的内容。它并不总是对你有直接危险,但它可能会为第三方带来危险活动。这不是互联网最初的目的。我认为你应该托管自己的 DNS 服务,以保护你的互联网历史记录的私密性,并避免被微软、谷歌和亚马逊等已知跟踪器掌握。在你的网络上试用 AdGuard Home 吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/open-source-dns-server
作者:[Amar Gandhi][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/amar1723
[b]: https://github.com/lkxed/
[1]: https://opensource.com/article/18/2/block-ads-raspberry-pi
[2]: https://github.com/AdguardTeam/AdGuardHome
[0]: https://img.linux.net.cn/data/attachment/album/202303/29/150451m9ggza42gagt9gih.jpg

View File

@ -0,0 +1,68 @@
[#]: subject: "Firefox 111 Released with New Native Notifications"
[#]: via: "https://debugpointnews.com/firefox-111/"
[#]: author: "arindam https://debugpointnews.com/author/dpicubegmail-com/"
[#]: collector: "lkxed"
[#]: translator: "Cubik65536"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15639-1.html"
Firefox 111 已发布,带来了原生系统通知
======
![][0]
> Firefox 111 已发布,带来了原生通知、新增的本地化语言以及增强的 Web 平台功能。
![在 Linux 上运行的 Firefox 111][1]
### Firefox 111 发布亮点
Firefox一个流行的网络浏览器已经发布了 111 版本,其中引入了几个新功能和增强功能。其中一个突出的新增功能是支持 Windows 原生的系统通知,为整个平台提供了更流畅和一致的用户体验。
除此之外Firefox Relay 用户现在可以轻松地从 Firefox 凭据管理器中直接创建 Relay 邮箱。此功能仅适用于登录了 Firefox 帐户的用户,为其在线活动提供了额外的隐私和安全保护。
另外Firefox 111 已经通过添加两个新的语言 <ruby>弗留利语<rt>Silhe Friulian</rt></ruby>fur<ruby>撒丁语<rt>Sardinian</rt></ruby>sc 来扩大其语言支持列表。这一举措旨在为世界各地的 Firefox 用户提供更好的可访问性和包容性。
在 Web 平台方面Firefox 已经在表单元素上引入了 “rel” 属性,使开发人员可以更轻松地指定当前文档与表单目标之间的关系。这一功能与其他浏览器兼容,并简化了 Web 应用程序的开发过程。
最后Firefox 已经启用了 <ruby>原点私有文件系统访问<rt>origin private file system access</rt></ruby>,这是一种新的存储 API允许 Web 应用程序在沙箱中存储和检索文件系统中的数据。这一增强功能为开发人员提供了对数据存储和检索过程的更多控制,确保用户数据的安全性和隐私性。
### 下载和更新
对于 Linux 发行版,如果你通过发行版的官方仓库使用 Firefox那么你应该在几天内获得此更新。
但是,你也可以从下面的页面下载此版本的压缩版本。有关其他下载选项,请访问我们的 [Firefox 下载指南][2]。
> **[下载 Firefox 111][3]**
祝浏览愉快!
- [官方发布通知][4]
- [Beta110 发布通知][5]
- [开发者发布版本通知][6]
### 总结
总体来说Firefox 111 版本提供了一系列新功能和增强功能,这些功能提高了用户体验,并为 Web 开发人员提供了更丰富的控制权和安全性。凭借其对可访问性、包容性和隐私方面的投入Firefox 仍然是全球用户的首选浏览器。
--------------------------------------------------------------------------------
via: https://debugpointnews.com/firefox-111/
作者:[arindam][a]
选题:[lkxed][b]
译者:[Cubik65536](https://github.com/Cubik65536)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://debugpointnews.com/author/dpicubegmail-com/
[b]: https://github.com/lkxed/
[1]: https://debugpointnews.com/wp-content/uploads/2023/03/Firefox-111-Running-in-Linux.jpg
[2]: https://www.debugpoint.com/download-firefox/
[3]: https://ftp.mozilla.org/pub/firefox/releases/111.0/
[4]: https://www.mozilla.org/en-US/firefox/111.0/releasenotes/
[5]: https://www.mozilla.org/en-US/firefox/111.0beta/releasenotes/
[6]: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/111
[0]: https://img.linux.net.cn/data/attachment/album/202303/19/144348oyfh999yy292f0f9.jpg

View File

@ -0,0 +1,169 @@
[#]: subject: "Variables in Python: Concepts with Examples"
[#]: via: "https://www.debugpoint.com/python-variables/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15668-1.html"
Python 中的变量:概念与示例
======
![][0]
> 本教程解释了 Python 中变量的概念、它们的类型,以及如何在实际项目中使用的示例。
在 Python 中,变量是存储值的保留内存位置。
它们是个名称,可以分配一个值给它并在整个代码中引用它。使用变量使值可访问并为值提供与你的代码相关的上下文/含义。
在开始之前,我希望你已经安装了 Python 并设置了一个基本的编辑器。如果没有,请参考我的以下指南:
- [如何在 Ubuntu/Linux 上安装 Python 3.11][1]
- [如何在 Windows 上安装 Python][2]
- [如何为 Python 设置 IDLE 编辑器][3]
### 变量规则
- 变量区分大小写。
- 变量名称只能包含大写和小写字母AZ、az、数字09和下划线_
- 它们不能以数字开头。
- Python 变量是 [动态类型][4]。
- Python 支持 Unicode 变量(例如 é 和 ü 等装饰字母,甚至中文、日文和阿拉伯符号)。
- 根据 [PEP 8 标准][5],变量名只能是小写,单词可以用下划线分隔(例如 total_price
### Python 变量:示例
要在 Python 中创建一个变量,我们需要使用赋值运算符(`=`)为其赋值。例如,下面的代码行创建了一个名为 `x` 的变量并为其赋值 `10`
```
x = 10
```
在 Python 中变量是动态类型的这意味着解释器可以根据分配给它的值来确定变量的数据类型。Python 支持各种类型的变量,包括整数、浮点数、字符串、布尔值和复数。
```
# 整型变量
age = 20
# 浮点变量
price = 4.99
# 字符串变量
name = "John Doe"
# 布尔变量
is_active = True
# 复数变量
z = 2 + 3j
```
变量在编程中很有用,因为它们允许我们存储和操作数据。例如,我们可以使用变量来执行数学运算、连接字符串以及根据布尔变量的值做出决策。
```
# 数学运算
x = 5
y = 10
z = x + y
print(z) # 输出15
# 字符串连接
first_name = "John"
last_name = "Doe"
full_name = first_name + " " + last_name
print(full_name) # 输出John Doe
```
![A simple demonstration of variables in Python][6]
变量也可以在现实世界的项目中用于存储和操作数据。例如,在 Web 应用中,我们可以使用变量来 [存储用户输入][7]、数据库查询以及向用户输出数据。
```
# 用户输入
name = input("What is your name? ")
print("Hello, " + name + "!") # 输出: Hello, John!
# 数据库查询
import sqlite3
conn = sqlite3.connect("example.db")
cursor = conn.cursor()
cursor.execute("SELECT * FROM users WHERE id = ?", (1,))
user = cursor.fetchone()
print(user) # 输出: (1, 'John Doe', 'johndoe@example.com')
# 输出数据给用户
balance = 100.00
print("Your current balance is ₹" + str(balance)) # 输出: Your current balance is ₹100.0
```
### 使用变量时的常见错误
在处理变量时,你可能会遇到一些常见错误。这里是其中的一些。
- `NameError`:当你尝试访问尚未定义的变量时会发生此错误。例如,如果你尝试打印一个尚未赋值的变量的值,你将得到一个 `NameError`。以下代码给出了 `NameError`,因为变量 `Full_name` 未定义。
```
# NameError 演示
first_name = "John"
last_name = "Doe"
full_name = first_name + " " + last_name
print(Full_name) # NameError
```
![NameError example][8]
- `TypeError`:当你尝试对错误数据类型的变量进行操作时会发生此错误。例如,如果你尝试连接一个字符串和一个整数,你将得到 `TypeError`。下面的代码片段给出了 `TypeError`
```
# TypeError 演示
first_name = "John"
age = 10
print(first_name + age)
```
![TypeError example in Python][9]
- `ValueError`:当你尝试将变量转换为不同的数据类型但无法进行转换时会发生此错误。例如,如果你尝试将包含字母的字符串转换为整数,你将得到 `ValueError`
```
# ValueError 演示
first_name = "John"
age = 10
print(int(first_name))
```
![ValueError in Python][10]
### 总结
了解变量对于任何 Python 开发人员来说都是必不可少的。变量允许我们存储和操作数据、执行数学运算、连接字符串等。如果你是 Python 编程的初学者,我希望本指南能够阐明这个概念。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/python-variables/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://linux.cn/article-15230-1.html
[2]: https://linux.cn/article-15480-1.html
[3]: https://linux.cn/article-15622-1.html
[4]: https://en.wikipedia.org/wiki/Type_system
[5]: https://peps.python.org/pep-0008/
[6]: https://www.debugpoint.com/wp-content/uploads/2023/03/A-simple-demonstration-of-variables-in-Python.jpg
[7]: https://linux.cn/article-15660-1.html
[8]: https://www.debugpoint.com/wp-content/uploads/2023/03/NameError-example.jpg
[9]: https://www.debugpoint.com/wp-content/uploads/2023/03/TypeError-example-in-Python.jpg
[10]: https://www.debugpoint.com/wp-content/uploads/2023/03/ValueError-in-Python.jpg
[0]: https://img.linux.net.cn/data/attachment/album/202303/28/090047xt7zffdrgrmmfxrn.jpg

View File

@ -0,0 +1,212 @@
[#]: subject: "Ubuntu 23.04 “Lunar Lobster”: Best New Features"
[#]: via: "https://www.debugpoint.com/ubuntu-23-04-features/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15669-1.html"
Ubuntu 23.04 “Lunar Lobster” 的最佳新功能
======
![][0]
> 介绍最新的 Ubuntu 23.04 “Lunar Lobster” 版本,它包含了大量的新功能和改进。
代号为 “<ruby>月球龙虾<rt>Lunar Lobster</rt></ruby>” 的 Ubuntu 23.04 是 2023 年的第一个短期版本,它将被支持 9 个月,直到 2024 年 1 月。这个版本采用了新的软件包和技术来改进 Ubuntu 的核心后台和进展工作。在某种程度上,许多变化是作为明年的 LTS 版本Ubuntu 24.04)的准备工作而被确定的。
它的开发周期几乎接近结束。截至发稿时,测试版已经冻结。所以,现在是探索这个版本的新功能的好时机。
但在此之前,先来看看即将到来的里程碑:
- 测试版冻结: 2023 年 3 月 27 日
- 测试版发布: 2023 年 3 月 30 日
- 候选版本2023 年 4 月 13 日
- 最终版本2023 年 4 月 20 日
![Ubuntu 23.04 Lunar Lobster Daily Live desktop][1]
### Ubuntu 23.04 的新功能
#### 新的桌面安装程序
Ubuntu 新的基于 Rust 的桌面安装程序终于可以在这个版本中体验了。这项工作历经了两年多的时间。在经历了许多障碍和关键错误的修复后,现在已经稳定到可以在正式版本中发布。从这个版本开始,经典的 Ubiquity 被全新的安装程序所取代,如下面一组图片所示:
![新的 Ubuntu 安装程序--主页面][2]
![分区摘要页][3]
![外观变化][4]
![用户信息页面][5]
然而,正如我从一些消息来源听到的,旧的 Uqiuity 将继续保留(直到明年)。但我不完全确定旧的安装程序将如何启动。因为默认的 <ruby>立付介质<rt>Live Media</rt></ruby> 会启动新的安装程序。
与旧安装程序的相比,新的有一些变化。首先,相对于旧的 Uqiuity 对话框和小工具控制,外观和感觉更加现代。
关于分区的摘要细节现在作为一个单独的页面出现,而不是一个弹出框。
此外Ubuntu 23.04 现在在安装前会询问深色/浅色模式选项。我不确定这样做的必要性,因为 Ubuntu 已经在一个单独的应用程序中定义了一些开箱步骤。
#### GNOME 44 桌面
Ubuntu 23.04 桌面版采用了 GNOME 44。这个版本的 GNOME 44 带来了一堆长期等待的更新。例如,在这个版本中,你可以在本地文件选取器对话框中体验到图像预览。此外,文件应用得到了期待已久的缺失功能,即原生的文件夹展开视图(树状视图)。你可以使用下面的设置来启用它。
![新的可展开文件夹视图][6]
![启用树状视图的设置][7]
在 GNOME 44 中的其他关键变化包括:文件应用现在支持在粘贴图像数据时创建文件,改进的无障碍设置页面可以提供更好的导航,以及大大改进的 GNOME 网页浏览器。
你可以在下面这篇功能亮点页面上了解更多关于 GNOME 44 的发布:
> **[GNOME 44 - 最佳功能][8]**
#### 精简 ISO 镜像
这是一个令人惊讶的举动Ubuntu 团队在这个版本中 [引入][9] 一个官方的精简 ISO 镜像(不到 200MB。一旦发布你可以使用这个精简 ISO 镜像来创建自定义的 Ubuntu Linux。截至发稿时我们还没有得到这个精简镜像的日常构建 ISO。
然而Xubuntu 团队 [已经发布了][10] 一个精简 ISO 镜像,我尝试了一下。同样地,所有的官方风味版都有望得到他们自己的精简 ISO 文件。
更多的信息将在未来几天内到达。
#### 多用 Snap少用 Flatpak
一些与 Snap 和 Flatpak 相关的重要变化即将到来,你应该为此做好准备。
首先,推行更多的 Snap 包是显而易见的,因为官方 Telegram 桌面应用程序现在在 Ubuntu 中使用 Snap 包。
此外Ubuntu 计划将 Steam 桌面客户端作为 Snap 包发布,该客户端 [目前正在测试中][11]。Steam 桌面客户端现在以原生 deb 和 Flatpak 包的形式提供。Steam Snap 预计将在今年年底到来,而不是在这个版本中。
与此同时,默认的 Flatpak 和 Flathub 集成现在已经正式从所有支持的 Ubuntu 官方风味版中 [移除][12]。这个决定在网上引起了一些 “讨论”。
因此从这个版本开始Ubuntu MATE 和 Kubuntu 将不会默认搭载 Flatpak/Flathub。然而你可以通过 [只需几个步骤][13] 安装它。
#### 新的应用程序
Ubuntu 23.04 的默认应用程序集合一如既往地进行了升级。然而,你可能会注意到一些关键的变化。
首先LibreOffice 可能看起来有点不同。LibreOffice 团队最近改变了默认的图标主题,在 Ubuntu GNOME 的桌面环境中,它看起来非常棒。
在这个版本中包含的 LibreOffice 7.5 中, Writer 有一个改进的书签模块Calc 电子表格有了新的数字格式Impress 有了新的表格设计风格等等。
你可以在这里阅读更多关于 [LibreOffice 7.5 的功能][14]。
![新的 LibreOffice 图标][15]
Ubuntu 23.04 中其他应用程序的总结:
- [Firefox 111][16]Snap
- LibreOffice 7.5
- Transmission 3.0
- Shotwell 图像查看器 0.30
#### 官方风味版
对于所有的教育工作者和学生来说,有一个好消息。从 23.04 版本开始Edubuntu 将 [正式出现][17]。它是 Ubuntu 官方风味版列表中的另一个补充。Edubuntu 可能会有一个更大的 ISO 文件(大约 5GB并安装了所有与教育有关的 FOSS 软件。我将会有一篇单独的文章来点评这个风味版。
此外,如下的风味版都有其对应的桌面环境:
- 配备 [KDE Plasma 5.27][18] 的 Kubuntu
- 配备 [Xfce 4.18][19] 的 Xubuntu
- 配备 MATE 1.26.1 的 Ubuntu MATE
- 配备 [LXQt 1.2][20] 的 Lubuntu
- 配备 Budgie 10.7 的 Ubuntu Budgie
Ubuntu Budgie 23.04 带来了一些令人兴奋的功能,如边缘平铺、热角等。
#### 内核和工具链更新
截至发稿时,每日构建副本都是 Linux 内核 6.1。然而在内核冻结2023 年 4 月 6 日)之前,目前的主线内核 6.2 可能会到达 Ubuntu 23.04。Linux 内核 6.2 改进了对 GPU、CPU、端口和 Rust 更新的支持。
在核心部分Python 3.11 现在可以在 Ubuntu 23.04 中开箱即用。你不需要再单独 [安装 Python 3.11][21]。值得一提的是Python 3.12 版本将在今年发布,目前正在进行多次 RC 测试。
其他工具链的更新如下:
- GCC 13
- GlibC 2.37
- Ruby 3.1
- golang 1.2
- LLVM 16
#### Ubuntu 23.04 的新壁纸
桌面版本永远不会缺席一些新的很酷的壁纸。在成功的 [壁纸竞赛][22] 之后,获胜者被选为以 “月亮和龙虾” 为特色的默认壁纸。
这里是默认的一张。而其余的你可以在 [这里][23] 找到。
![Ubuntu 23.04 Lunar Lobster 默认壁纸][24]
### 下载
每日构建的 ISO 文件存在于以下 Ubuntu 桌面和风味版的链接中。
请注意,你不应该将这些作为主要用途。它们有一些错误(至少我发现了一些),而且还不完全稳定。
| Ubuntu 风味版 | .iso 镜像 - 日常构建 |
|:-:|:-:|
| Ubuntu 23.04 桌面GNOME| [https://cdimage.ubuntu.com/ubuntu/daily-live/pending/][25] |
| Xubuntu 23.04 | [https://cdimage.ubuntu.com/xubuntu/daily-live/current/][26] |
| Ubuntu MATE 23.04 | [https://cdimage.ubuntu.com/ubuntu-mate/daily-live/current/][27] |
| Ubuntu Kylin 23.04 | 尚无 |
| Lubuntu 23.04 | [https://cdimage.ubuntu.com/lubuntu/daily-live/current/][28] |
| Kubuntu 23.04 | [https://cdimage.ubuntu.com/kubuntu/daily-live/current/][29] |
| Ubuntu Budgie 23.04 | [https://cdimage.ubuntu.com/ubuntu-budgie/daily-live/current/][30] |
| Ubuntu Unity 23.04 | [https://cdimage.ubuntu.com/ubuntu-unity/daily-live/current/][31] |
| Edubuntu 23.04 | [https://cdimage.ubuntu.com/edubuntu/daily-live/current/][32] |
### 总结
总之,新的 Ubuntu 23.04 有望为桌面用户提供更流畅、更无缝的体验。
从改进的安全功能到增强的生产力工具和应用程序,这次更新肯定会让 Ubuntu 的爱好者和粉丝感到高兴。无论你是经验丰富的用户还是 Ubuntu 生态系统的新手,这个版本都值得一看。
最后Ubuntu 23.04 将于 2023 年 4 月 20 日发布。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/ubuntu-23-04-features/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/wp-content/uploads/2023/03/Ubuntu-23.04-Lunar-Lobster-Daily-Live-desktop.jpg
[2]: https://www.debugpoint.com/wp-content/uploads/2023/03/New-Ubuntu-Installer-main-page.jpg
[3]: https://www.debugpoint.com/wp-content/uploads/2023/03/Partition-summary-page.jpg
[4]: https://www.debugpoint.com/wp-content/uploads/2023/03/Appearane-changes.jpg
[5]: https://www.debugpoint.com/wp-content/uploads/2023/03/User-information-page.jpg
[6]: https://www.debugpoint.com/wp-content/uploads/2023/02/New-expandable-folder-view.jpg
[7]: https://www.debugpoint.com/wp-content/uploads/2023/02/Settings-to-enable-tree-view.jpg
[8]: https://www.debugpoint.com/gnome-44/
[9]: https://debugpointnews.com/ubuntu-mini-iso-announcement/
[10]: https://www.debugpoint.com/xubuntu-minimal/
[11]: https://discourse.ubuntu.com/t/steam-call-for-testing/34575
[12]: https://debugpointnews.com/ubuntu-flavours-flatpak/
[13]: https://www.debugpoint.com/how-to-install-flatpak-apps-ubuntu-linux/
[14]: https://www.debugpoint.com/libreoffice-7-5/
[15]: https://www.debugpoint.com/wp-content/uploads/2023/03/New-LibreOffice-Icons.jpg
[16]: https://debugpointnews.com/firefox-111/
[17]: https://discourse.ubuntu.com/t/announcing-edubuntu-revival/32929
[18]: https://www.debugpoint.com/kde-plasma-5-27/
[19]: https://www.debugpoint.com/xfce-4-18-review/
[20]: https://www.debugpoint.com/lxqt-1-2-0-features/
[21]: https://www.debugpoint.com/install-python-3-11-ubuntu/
[22]: https://debugpointnews.com/ubuntu-23-04-wallpaper-competition/
[23]: https://discourse.ubuntu.com/t/lunar-lobster-23-04-wallpaper-competition/33132
[24]: https://www.debugpoint.com/wp-content/uploads/2023/03/Ubuntu-23.04-Lunar-Lobster-Default-Wallpapers.jpg
[25]: https://cdimage.ubuntu.com/ubuntu/daily-live/pending/
[26]: https://cdimage.ubuntu.com/xubuntu/daily-live/current/
[27]: https://cdimage.ubuntu.com/ubuntu-mate/daily-live/current/
[28]: https://cdimage.ubuntu.com/lubuntu/daily-live/current/
[29]: https://cdimage.ubuntu.com/kubuntu/daily-live/current/
[30]: https://cdimage.ubuntu.com/ubuntu-budgie/daily-live/current/
[31]: https://cdimage.ubuntu.com/ubuntu-unity/daily-live/current/
[32]: https://cdimage.ubuntu.com/edubuntu/daily-live/current/
[0]: https://img.linux.net.cn/data/attachment/album/202303/28/170903lijh6axllqqei9bx.jpg

View File

@ -0,0 +1,144 @@
[#]: subject: "GNOME 44 is Here With New Tricks Up its Sleeve"
[#]: via: "https://news.itsfoss.com/gnome-44-release/"
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15659-1.html"
GNOME 44 发布
======
> GNOME 44 终于来了,它带来了重新打造的设置应用,更新了快速设置功能,改进了可访问性等等。
![GNOME 44][1]
GNOME 可以说是***最受欢迎的桌面环境**之一。
之前的 [GNOME 43 版本][2] 就补充了许多有用的功能,而现在的 GNOME 44 版本也是一样。
让我们看看都有哪些内容。
### 🆕 GNOME 44 有什么新功能?
![介绍 GNOME 44][3]
我们最近已经分别介绍了 GNOME 44 的最佳功能;在这里,让我回顾一下这个发布的相关细节。
主要的亮点包括:
- 设置菜单的改造
- 快速设置的改进
- 文件选择器的网格视图
- 文件管理器的改进
#### 1、设置菜单的改造
![GNOME 44 上更新的设置菜单的截图][4]
设置菜单进行了小规模的改造,**可访问性面板被重新设计**,以提供一个更现代的导航体验。
![鼠标和触摸板设置更新后的截图][5]
然后,一项新的功能让你可以 **通过二维码分享 Wi-Fi 密码**,并且改进了鼠标/触摸板设置。
“设备安全”下的信息也得到了更新,以增加技术细节的清晰度。
![GNOME 44 设备安全][6]
#### 2、改进的快速设置菜单
![GNOME 44 快速设置面板中的蓝牙设置截图][7]
快速设置面板已经得到了许多更新;它现在可以让你 **查看和管理当前连接的蓝牙设备**
但你必须前往设置菜单来配对新设备。
![GNOME 44 快速设置菜单中的新截图快捷方式][8]
另一个新增功能是**新的屏幕截图快捷方式**,可以毫不费力地从快速设置菜单中进行屏幕截图。
这还不是全部GNOME 44 的快速设置菜单现在有一个检查**在后台运行的应用程序的巧妙方法**。
![][9]
你可以在我们之前的报道中找到关于这个功能的更多细节:
> **[GNOME 正在(某种程度上)恢复在几年前删除的功能](https://linux.cn/article-15551-1.html)**
#### 3、新的锁屏/登录窗口
![GNOME 44 的新锁屏和登录窗口的截图][10]
GNOME 44 提供了**更新的锁屏和登录窗口**,有一个更大的用户头像和各种元素的细微变化,例如时钟的字体大小。
#### 4、GNOME 文件选取器中的缩略图
![GNOME 44 的文件选取器中的文件缩略图预览截图][11]
去年年底,我们看到了 GNOME 文件选取器的一个**长时间要求的功能** 的 [回归][12],而现在它终于到来了。
GNOME 的文件选取器从来没有一个合适的缩略图预览来查看文件。取而代之的是,它**依赖于一个普通的列表视图**。
直到现在。
它现在**带来了一个合适的缩略图视图**,可以通过点击文件选取器右上角的 “列表-网格视图” 切换进行切换。
#### 🛠️ 其他变化和改进
![GNOME 44 壁纸集合][13]
这些并不是 GNOME 44 带来的唯一改进;这里有一些值得一提的改进:
- 新壁纸。
- 对文件管理器的各种小更新带来了性能的提高。
- Epiphany 网页浏览器被移植到 GTK4并进行了许多错误修正。
- 在 GNOME 软件应用中加入了一个新的过滤器,激活后只显示开源的应用程序。
- 对联系人应用进行了各种改进,能够以二维码的形式分享联系人。
- 对 GNOME Builder 的许多 UI 和风格进行了修复。
- 在 [GNOME Circle][14] 集合中添加了十个新的应用程序。
你可以通过 [官方发布说明][15] 来了解更多。
### 开始使用 GNOME 44
你可以在下个月期待 GNOME 44 与 Ubuntu 23.04 和 Fedora 38 一起出现。
如果你迫不及待地想得到它,使用 [Boxes][17] 安装 [GNOME OS][16] 应该是一个测试它的好方法。
> **[GNOME][18]**
💬 你对这个丰富的 GNOME 44 更新有何看法?你想在你的 Linux 系统上使用它吗?
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/gnome-44-release/
作者:[Sourav Rudra][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/sourav/
[b]: https://github.com/lkxed/
[1]: https://news.itsfoss.com/content/images/size/w1304/2023/03/gnome-44-release.jpg
[2]: https://news.itsfoss.com/gnome-43-release/
[3]: https://youtu.be/N7SGe1MiqNA
[4]: https://news.itsfoss.com/content/images/2023/03/GNOME44_settings.jpg
[5]: https://news.itsfoss.com/content/images/2023/03/GNOME44_settings_2.jpg
[6]: https://news.itsfoss.com/content/images/2023/03/gnome-44-device-security.png
[7]: https://news.itsfoss.com/content/images/2023/03/GNOME44_QuickSettings.jpg
[8]: https://news.itsfoss.com/content/images/2023/03/GNOME44_QuickSettings_2.jpg
[9]: https://news.itsfoss.com/content/images/2023/03/background-app-running--1-.png
[10]: https://news.itsfoss.com/content/images/2023/03/GNOME44_lockscreen.jpg
[11]: https://news.itsfoss.com/content/images/2023/03/GNOME44_file_view.jpg
[12]: https://news.itsfoss.com/gnome-file-picker/
[13]: https://news.itsfoss.com/content/images/2023/03/gnome-44-wallpapers.jpg
[14]: https://circle.gnome.org/?ref=its-foss-news
[15]: https://release.gnome.org/44/?ref=its-foss-news
[16]: https://os.gnome.org/?ref=its-foss-news
[17]: https://wiki.gnome.org/Apps/Boxes?ref=its-foss-news
[18]: https://www.gnome.org/getting-gnome/?ref=its-foss-news

View File

@ -0,0 +1,77 @@
[#]: subject: "Adding a Pop of Color to GNOME: Accent Colors Are on the Way"
[#]: via: "https://news.itsfoss.com/gnome-accent-colors/"
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15665-1.html"
为 GNOME 添加流行色彩: 强调色即将问世
======
> GNOME 用户,你在等待这一刻吗?准备好选择你的颜色吧!
![GNOME 的强调色][0]
从 [Ubuntu 22.04 LTS][2] 开始Ubuntu 上就有了对强调色的支持人们都很喜欢它。然而遗憾的是GNOME 从来没有这样的支持。
现在,得益于一项在 GNOME 中引入强调色支持的工作,这种情况正在改变。
**具体情况如何?** 最近,[Alexander Mikhaylenko][4] 发出了一个附有 [合并请求][3] 的提议,以在 GNOME 中添加对强调色的支持。
在目前,它还处于一个 **早期开发中状态**,尚有很多工作要做,还有一些问题要在最终发布前解决。
通过查看其代码,很明显,**最初将提供对 10 种强调色的支持**,发布后可能会有更多的选择。
**想知道它可能看起来如何?**
在 Mastodon 上的一个 [讨论][5] 中GNOME 基金会的成员 [Jamie][6] 分享了一些由 Alexander 制作的模拟图,其中描绘了两种不同的配色。
一个是绿色的:
![GNOME 即将推出的强调色支持的早期预览][7]
另一个是蓝色的:
![GNOME 即将推出的强调色支持的另一个早期预览][8]
我必须说,这些看起来不错 😃。想在非 Fedora 发行版上得到一些 Fedora 的爱吗?把它变成蓝色和其他东西?就它了!
> 📝 请记住,你在上面看到的东西在最终发布前可能会有变化。
**预期时间?** 在上述讨论中被另一个用户问到时Alexander 提到,我们可以 **预期强调色支持会在 GNOME 45 中出现**
鉴于 GNOME 44 最近才发布,我们还需要等待一段时间才能真正看到它的实现。
但是,很高兴知道它有可能在不久之后出现。
我很喜欢 GNOME 终于得到了对强调色的支持,我希望这种等待是值得的。
如果你问我,我喜欢在我的 GNOME 系统上有绿色的强调色。你呢?
参考自: [OMG! Linux][9]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/gnome-accent-colors/
作者:[Sourav Rudra][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/sourav/
[b]: https://github.com/lkxed/
[1]: https://news.itsfoss.com/content/images/size/w1304/2023/03/gnome-accent-picker.jpg
[2]: https://news.itsfoss.com/ubuntu-22-04-release/
[3]: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2715?ref=its-foss-news
[4]: https://gitlab.gnome.org/exalm?ref=its-foss-news
[5]: https://crab.garden/@jamie/110063105101806314?ref=its-foss-news
[6]: https://crab.garden/@jamie?ref=its-foss-news
[7]: https://news.itsfoss.com/content/images/2023/03/GNOME_Accent_Color_1.png
[8]: https://news.itsfoss.com/content/images/2023/03/GNOME_Accent_Color_2.png
[9]: https://www.omglinux.com/gnome-accent-colors-are-coming/?ref=its-foss-news
[0]: https://img.linux.net.cn/data/attachment/album/202303/27/092558szpjzk341lv7zvvg.jpg

View File

@ -0,0 +1,81 @@
[#]: subject: "Open-Source Model 'Dolly' Claims to be a Cheaper Alternative to ChatGPT"
[#]: via: "https://news.itsfoss.com/open-source-model-dolly/"
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
[#]: collector: "lkxed"
[#]: translator: "lxbwolf"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15678-1.html"
号称可以成为 ChatGPT 平替的开源模型 “Dolly”
======
> 你需要一款 ChatGPT 的平替?还得是开源的?看起来我们已经被卷入了与 ChatGPT 的开源大战。
![open source model dolly][1]
Databricks 这家软件公司,在各个领域都有所建树,尤其是在数据仓库和基于人工智能的解决方案方面。
最近,随着 ChatGPT 横空出世Meta、谷歌甚至 Mozilla 都开始效仿 ChatGPT。
而现在Databricks 开源了其 <ruby>[大型语言模型][3]<rt>large language model</rt></ruby>LLM“Dolly”也正在以自己的方式进行尝试。
我们一起来看看它。
**发生了什么?** 在最近的公告中Databricks 介绍了他们号称 “**廉价构建**” 的 LLM使用 [EleutherAI][5] 的已经开源的参数 [模型][4] 提供功能。
他们在该模型基础上稍作调整,赋予了 Dolly 指令诸如头脑风暴和文本生成的能力。
当你拿它与 GPT-3 中的 **1750 亿个参数** 比较时Dolly 的 **60 亿个参数** 就可能显得微不足道。
但是,当 Databricks 的人看到即使数据量与 GPT-3 相差这么多Dolly 也能 **展示很多与 ChatGPT 相同的能力** 时,他们感到非常震惊。
下面是他们展示的其中一个例子:
![a screenshot of how dolly performs in an open question and answer scenario][6]
原始模型使用了 [Alpaca][7] 的数据,该模型由斯坦福大学以 Meta 的 [LLaMA][8] LLM 为基础建立。
但是,正如你所看到的,原始模型产生了一个非常杂乱无章的结果,而 Dolly通过不同的模型和调整能够产生一个更为可用的答案。
> 📝 有趣的事实:“<ruby>多莉<rt>Dolly</rt></ruby>” 名字取自世界上第一只克隆羊。
**为什么是现在?** 根据 Databricks 的说法,他们认为 **许多公司更愿意建立自己的模型,**而不是将数据发送给某个紧紧掌握模型只对外提供 API 的集中式供应商。
许多公司可能不愿意将他们最敏感的数据交给第三方,然后在模型质量、成本和所需行为方面进行各种权衡。
**你想看看吗?**
当然,但有一个问题。
你必须 **使用他们的平台来使用 Dolly**,他们已经开源了一个 [Databricks 笔记本][9],可以帮助你在 Databricks 上构建它。
此外,如果你想获得训练好的权重,你必须联系他们。不过我不确定他们是否会免费提供使用权。
总而言之,这种开源其模型的举动应该对其他公司有好处,可以保护他们的数据、节省运营成本,其他公司也能使用它创建自己的模型。
你可以查看其 [公告博客][10],以了解更多技术细节和其他计划。
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/open-source-model-dolly/
作者:[Sourav Rudra][a]
选题:[lkxed][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/sourav/
[b]: https://github.com/lkxed/
[1]: https://news.itsfoss.com/content/images/size/w1304/2023/03/opensource-ai-model-dolly.png
[2]: https://news.itsfoss.com/content/images/2023/03/linux-mega-packt.webp
[3]: https://en.wikipedia.org/wiki/Large_language_model?ref=its-foss-news
[4]: https://huggingface.co/EleutherAI/gpt-j-6B?ref=its-foss-news
[5]: https://www.eleuther.ai/?ref=its-foss-news
[6]: https://news.itsfoss.com/content/images/2023/03/Dolly_AI.jpg
[7]: https://crfm.stanford.edu/2023/03/13/alpaca.html?ref=its-foss-news
[8]: https://ai.facebook.com/blog/large-language-model-llama-meta-ai/?ref=its-foss-news
[9]: https://github.com/databrickslabs/dolly?ref=its-foss-news
[10]: https://www.databricks.com/blog/2023/03/24/hello-dolly-democratizing-magic-chatgpt-open-models.html?ref=its-foss-news

View File

@ -0,0 +1,77 @@
[#]: subject: "Ubuntu Cinnamon Gets Official Ubuntu Flavor Status"
[#]: via: "https://news.itsfoss.com/ubuntu-cinnamon-official/"
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15677-1.html"
Ubuntu Cinnamon 正式成为 Ubuntu 官方风味版
======
> 在 Ubuntu 的混合风味中加入肉桂味,完美!
![][0]
在等待下个月的 Ubuntu 23.04 吗?
好吧,我们已经提到,在 Ubuntu 23.04 版本的 [令人兴奋][3] 的事情中,包括一个新的官方的 Cinnamon 风味(它最初是 Ubuntu Cinnamon Remix
而且,它**现在是官方版本*,因为 Ubuntu 的技术委员会以足够的票数 [批准了它][4]。
### Ubuntu Cinnamon 23.04 值得期待的地方
![Ubuntu Cinnamon 23.04 的屏幕截图][5]
如果你之前已经使用过 Ubuntu Cinnamon Remix非官方你可能对它有点概念了。
如果你想要一个带有 Cinnamon 桌面的 Ubuntu 风味版而没有众多的特殊定制Ubuntu Cinnamon 适合你。
而另一方面Linux Mint 也是一个基于 Ubuntu 的 Cinnamon 桌面。然而,你会得到一个 Mint 特有的主题、图标、工具和调整,体验有所不同。
基本上,如果你使用 Linux Mint它不会让你感觉到 “只是另一种 Ubuntu 风味”。
别忘了Linux Mint 默认禁用 Snap而且是 Flatpak 优先的,这与 Ubuntu Cinnamon 23.04 的情况完全相反。
![Ubuntu Cinnamon 菜单截图][6]
所以,如果你喜欢使用 Snap 而不是 Flatpak并且喜欢 Ubuntu 通常的风味版的工作方式Ubuntu Cinnamon 是一个不错的补充。关于这个版本的其他一些值得注意的地方包括:
- 预装的应用程序,如 [Synaptic Package Manager][7]、LibreOffice 等
- Ubuntu 的 Yaru 主题
- 没有像你期望的 Linux Mint 那样的 XApp
目前,根据其 [最新的日常构建][8]Ubuntu Cinnamon 23.04 几乎已经准备好发布(将于下个月发布)。
它是否会赢得 Linux Mint 用户的青睐,那是另外一个故事。但是,**Ubuntu 上的新 Cinnamon 版应该会让更多的用户尝试 Cinnamon 桌面,这是件好事**。
Cinnamon 桌面融合了传统 Windows 风格的布局,并提供了更多的功能。
你可以在 [Ubuntu Cinnamon 博客][9] 上阅读官方公告。
你考虑改用 Ubuntu Cinnamon 作为你的首选口味吗?请在评论中分享你的想法。
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/ubuntu-cinnamon-official/
作者:[Ankush Das][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lkxed/
[1]: https://news.itsfoss.com/content/images/size/w1304/2023/03/ubuntu-cinnamon-official-flavour.png
[2]: https://news.itsfoss.com/content/images/2023/03/linux-mega-packt.webp
[3]: https://news.itsfoss.com/ubuntu-23-04/
[4]: https://lists.ubuntu.com/archives/technical-board/2023-March/002725.html?ref=its-foss-news
[5]: https://news.itsfoss.com/content/images/2023/03/ubuntu-cinnamon-home.jpg
[6]: https://news.itsfoss.com/content/images/2023/03/ubuntu-cinnamon-menu.jpg
[7]: https://itsfoss.com/synaptic-package-manager/?ref=its-foss-news
[8]: https://cdimage.ubuntu.com/ubuntucinnamon/daily-live/current/?ref=its-foss-news
[9]: https://ubuntucinnamon.org/ubuntu-cinnamon-flavor-status-announcement/?ref=its-foss-news
[0]: https://img.linux.net.cn/data/attachment/album/202303/31/091748pq8tq8nluucc5eth.jpg

View File

@ -0,0 +1,341 @@
[#]: subject: "How to Install CRI-O (Container Runtime) on Ubuntu 22.04"
[#]: via: "https://www.linuxtechi.com/install-crio-container-runtime-on-ubuntu/"
[#]: author: "James Kiarie https://www.linuxtechi.com/author/james/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15687-1.html"
如何在 Ubuntu 22.04 上安装 CRI-O 容器运行时
======
![][0]
CRI-O 是 Kubernetes 的开源轻量级容器运行时。它是使用 <ruby>开放容器组织<rt>Open Container Initiative</rt></ruby>OCI兼容运行时的 Kubernetes <ruby>容器运行时接口<rt>Container Runtime Interface</rt></ruby>CRI的实现。在运行 Kubernetes 时,它是 Docker 的完美替代品。
在本指南中,我们将逐步演示如何在 Ubuntu 22.04 LTS 上安装 CRI-O。
### 先决条件
在开始之前,这是你需要的:
- 具有 SSH 访问权限的 Ubuntu 22.04 实例
- 在实例上配置的 sudo 用户
- 快速稳定的互联网连接
有了这个,让我们开始吧。
### 步骤 1更新系统并安装依赖
立即登录你的服务器实例,并按如下方式更新包列表:
```
$ sudo apt update
```
更新本地包索引后,按如下方式安装依赖项:
```
$ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
```
### 步骤 2添加 CRI-O 存储库
要安装 CRI-O我们需要在 Ubuntu 上添加或启用它的仓库。但首先,你需要根据操作系统和要安装的 CRI-O 版本定义变量。
因此,定义如下变量:
```
$ export OS=xUbuntu_22.04
$ export CRIO_VERSION=1.24
```
完成后,运行以下命令集以添加 CRI-O Kubic 仓库:
```
$ echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /"| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
$ echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$CRIO_VERSION/$OS/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$CRIO_VERSION.list
```
![][1]
此后,为 CRI-O 仓库导入 GPG 密钥:
```
$ curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$CRIO_VERSION/$OS/Release.key | sudo apt-key add -
$ curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key add -
```
这会产生如下输出:
![][2]
再次更新包索引,使系统与新添加的 CRI-O Kubic 仓库同步:
```
$ sudo apt update
```
### 步骤 3在 Ubuntu 22.04 上安装 CRI-O
添加仓库后,使用 APT 包管理器安装 CRI-O 和运行时客户端:
```
$ sudo apt install cri-o cri-o-runc -y
```
![][3]
安装后,启动并启用 CRI-O 守护程序:
```
$ sudo systemctl start crio
$ sudo systemctl enable crio
```
接下来,验证 CRI-O 服务是否正在运行:
```
$ sudo systemctl status crio
```
你应该看到以下输出,表明 CRI-O 服务正在按预期运行:
![][4]
### 步骤 4为 CRI-O 安装 CNI 插件
接下来,你需要安装 CNI<ruby>容器网络接口<rt>Container Network Interface</rt></ruby>)以及 CNI 插件。请记住,环回和桥接配置已启用并且足以使用 CRI-O 运行 <ruby>容器荚<rt>Pod</rt></ruby>
因此,要安装 CNI 插件,请运行以下命令:
```
$ sudo apt install containernetworking-plugins -y
```
安装后,编辑 CRI-O 配置文件:
```
$ sudo nano /etc/crio/crio.conf
```
取消注释 `network_dir``plugin_dirs` 部分,并在 `plugin_dirs` 下添加 `/usr/lib/cni/`
![][5]
保存更改并退出配置文件。
接下来,重启 CRIO 服务:
```
$ sudo systemctl restart crio
```
### 步骤 5安装 CRI-O 工具
此外,你还需要安装 `cri-tools` 包,它提供了 `crictl` 命令行程序,用于交互和管理容器和 pod。
为此,请运行以下命令:
```
$ sudo apt install -y cri-tools
```
安装后,确认 `crictl` 的版本和 `RunTimeVersion` 如下:
```
$ sudo crictl --runtime-endpoint unix:///var/run/crio/crio.sock version
```
![][6]
一定要检查 CRI-O 是否准备好使用以下命令部署容器荚:
```
$ sudo crictl info
```
![][7]
`crictl` 命令提供自动补全功能,让你可以通过按 `TAB` 键自动补全命令。要启用命令补全,请运行以下命令:
```
$ sudo su -
# crictl completion > /etc/bash_completion.d/crictl
```
然后重新加载当前的 Bash 会话:
```
# source ~/.bashrc
```
![][8]
要使用自动补全功能,你需要注销或启动新的终端会话。然后只需键入 `crictl` 命令并按 `TAB` 键即可查看所有选项。
```
$ crictl
```
![][9]
### 步骤 6使用 crictl 程序创建容器荚
至此CRI-O 已完全安装和配置并准备好启动容器荚。在本节中,我们将在容器荚中创建一个 Apache Web 服务器并确认它是否正在处理请求。
首先,我们将使用容器荚配置文件设置一个沙箱或隔离环境,如下所示:
```
$ sudo nano apache_sandbox.json
```
然后我们将以下配置添加到文件中:
```
{
"metadata": {
"name": "apache-sandbox",
"namespace": "default",
"attempt": 1,
"uid": "hdishd83djaidwnduwk28bcsb"
},
"linux": {
},
"log_directory": "/tmp"
}
```
保存并退出。接下来使用以下命令创建容器荚。这会打印出很长的字母数字,它是容器荚 ID。
```
$ sudo crictl runp apache_sandbox.json
```
要确认容器荚已创建,请运行命令:
```
$ sudo crictl pods
```
![][10]
要检索有关创建的容器荚的更多信息,请运行以下命令:
```
$ sudo crictl inspectp --output table 05ba2f0704f22
```
这将打印出 ID、名称、UID、命名空间、创建日期、内部 IP 等详细信息。
![][11]
### 步骤 7在容器荚中创建容器
这部分中,我们将在容器荚中创建一个 Apache Web 服务器容器。因此,使用 `crictl` 程序从 Docker Hub 拉取 Apache Web 服务器镜像:
```
$ sudo crictl pull httpd
```
你可以如图所示验证拉取的镜像:
```
$ sudo crictl images
```
![][12]
接下来,我们将为 Apache Web 服务器定义一个容器配置文件:
```
$ sudo nano container_apache.json
```
复制并粘贴以下代码:
```
{
"metadata": {
"name": "apache"
},
"image":{
"image": "httpd"
},
"log_path":"apache.0.log",
"linux": {
}
}
```
保存并退出配置文件。
最后,要将容器连接到之前创建的沙盒容器荚,请运行以下命令:
```
$ sudo crictl create 05ba2f0704f22 container_apache.json apache_sandbox.json
```
这会向终端输出一长串字母数字 ID。请记下此 ID。
最后,使用 ID 启动 Apache Web 服务器容器,如下所示:
```
$ sudo crictl start 37f4d26510965452aa918f04d629f5332a1cd398d4912298c796942e22f964a7
```
![][13]
要检查容器状态,请运行以下命令:
```
$ sudo crictl ps
```
![][14]
要验证 Apache Web 服务器是否正在运行,请使用 `curl` 命令和容器荚的内部 ID 向 Web 服务器发送 HTTP 请求:
```
$ curl -I 10.85.0.2
```
以下输出确认 Web 服务器正在运行:
![][15]
### 结论
这就是全部的指南。我们已经在 Ubuntu 22.04 上成功安装了 CRI-O并继续创建容器荚和容器。欢迎你提出意见和反馈。
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/install-crio-container-runtime-on-ubuntu/
作者:[James Kiarie][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/james/
[b]: https://github.com/lkxed/
[1]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Set-Crio-Repository-Ubuntu-Linux.png
[2]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Import-GPG-Keys-for-Crio-Repository-Ubuntu-Linux.png
[3]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Apt-Install-Crio-Ubuntu-Linux.png
[4]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Start-Enable-Crio-Service-Ubuntu.png
[5]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crio-Conf-Network-Plugins-Directory-Ubuntu.png
[6]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crictl-Crio-Version-Check-Ubuntu-Linux.png
[7]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crictl-Info-Command-Ubuntu.png
[8]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Enable-Bash-Completion-Crictl-Command-Ubuntu.png
[9]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crictl-Command-Options-Ubuntu.png
[10]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crictl-Pods-Status-Ubuntu.png
[11]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crictl-Inspect-Pod-Ubuntu-Linux.png
[12]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Crictl-pull-image-ubuntu.png
[13]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Create-Container-Inside-Pod-Ubuntu-Linux.png
[14]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Pods-Status-Crictl-Command-Ubuntu.png
[15]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Curl-Command-Httpd-Pod-Ubuntu.png
[0]: https://img.linux.net.cn/data/attachment/album/202304/03/105419akd0pr3ns2n50nz0.jpg

View File

@ -0,0 +1,107 @@
[#]: subject: "3 surprising things Linux sysadmins can do with systemd"
[#]: via: "https://opensource.com/article/23/3/3-things-you-didnt-know-systemd-could-do"
[#]: author: "Alan Smithee https://opensource.com/users/alansmithee"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15685-1.html"
三件可以用 systemd 做的令人惊讶的事情
======
![][0]
> 它不仅仅是为了让你的电脑启动得更快。
当 systemd 刚问世时,有很多关于它能加快启动时间的消息。这项功能对大多数人都有吸引力(对那些不重启的人来说就不那么重要了),所以在很多方面,这也是它今天仍然拥有的声誉。虽然 systemd 确实是在启动过程中并行启动服务起到了作用,但它的作用远不止于此。以下是你可能没有意识到 systemd 可以做的三件事,但你应该好好利用。
### 1、简化 Linux ps
如果你曾经使用过 `ps`,甚至只是 `top` 命令,那么你就会知道你的电脑一直都在运行数百个进程。有时,这正是你需要的信息,以便了解你的计算机或其用户在做什么。其他时候,你真正需要的是一个总体的概览。
`systemd-cgtop` 命令提供了一个基于<ruby>控制组<rt>cgroup</rt></ruby>任务安排的计算机负载的简单视图。[控制组][2] 对现代 Linux 很重要,基本上是容器和 Kubernetes 的底层支持结构(这也是云计算可以扩展的原因),但它们也是家庭电脑上的有用结构。例如,从 `systemd-cgtop` 的输出中,你可以看到用户进程的负载,而不是系统进程:
```
Control Group Proc+ %CPU Memory Input/s Output/s
/ 183 5.0 1.6G 0B 3.0M
user.slice 4 2.8 1.1G 0B 174.7K
user.slice/user-1000.slice 4 2.8 968.2M 0B 174.7K
system.slice 65 2.2 1.5G 0B 2.8M
```
你也可以只查看你的用户空间进程,或者查看用户空间进程和内核线程。
这绝不是对 `top``ps` 的替代,而是从一个不同的、独特的角度来观察你的系统。在运行容器时,它可能是至关重要的,因为容器使用控制组。
### 2、Linux 定时任务
[Cron][3] 是 Linux 的一个经典组件。当你想安排一些事情定期发生时,你会使用 Cron。它很可靠而且相当好地集成到你的系统中。
问题是Cron 并不了解有些计算机会被关闭。如果你有一个安排在午夜的 Cron 任务,但你每天在 23:59 关闭你的电脑,那么你的 Cron 任务就永远不会运行。Cron 没有任何工具可以检测到一夜之间错过了工作。
作为对这个问题的回答,有一个很好的 [Anacron][4],但它不像 Cron 那样集成的好。要让 Anacron 运行,你需要做很多设置。
第二个选择是 systemd 计时器。和 Cron 一样,它也是内置的,可以随时使用。你需要写一个单元文件,这肯定比单行的 Crontab 条目多,但也很简单。例如,这里有一个单元文件,在开机 30 分钟后运行一个假想的备份脚本,但每天只运行一次。这可以确保我的电脑得到备份,并防止它每天尝试备份超过一次。
```
[Unit]
Description=Backup
Requires=myBackup.service
[Timer]
OnBootSec=30min
OnUnitActiveSec=1d
[Install]
WantedBy=timers.target
```
当然,你也可以干预并提示运行一个任务。多亏了 `OnUnitActiveSec` 指令systemd 不会试图运行你手动激活的作业。
### 3、运行 Linux 容器
容器使启动一个复杂的服务变得非常容易。你可以在短短几分钟内运行一个 [Mattermost][5] 或 Discourse 服务器。在某些情况下困难的部分是在你运行容器后管理和监控它们。Podman 使得管理它们变得容易,但是用什么来管理 Podman 呢?嗯,[你可以使用 systemd][6]。
Podman 有一个内置的命令来生成单元文件,这样你的容器就可以被 systemd 管理和监控:
```
$ podman generate systemd --new --files --name example_pod
```
然后你所要做的就是启动服务:
```
$ systemctl --user start pod-example_pod.service
```
和其他服务一样systemd 确保你的容器荚在任何情况下都能运行。它记录问题,你可以用 `journalctl` 和其他重要的日志来查看,你也可以用 `systemd-cgtop` 在控制组中监控它的活动。
它不是 [Kubernetes 平台][7]但对于一两个容器来说你只需要在可靠和可预测的基础上提供服务Podman 和 systemd 是一对很棒的组合。
### 下载 systemd 电子书
systemd 的内容还有很多,你可以从作者 [David Both][8] 的新书《[systemd 实用指南][1]》中了解基础知识,以及很多实用的技巧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/3-things-you-didnt-know-systemd-could-do
作者:[Alan Smithee][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/alansmithee
[b]: https://github.com/lkxed/
[1]: https://opensource.com/downloads/pragmatic-guide-systemd-linux
[2]: https://www.redhat.com/sysadmin/cgroups-part-four?intcmp=7013a000002qLH8AAM
[3]: https://opensource.com/article/17/11/how-use-cron-linux
[4]: https://opensource.com/article/21/2/linux-automation
[5]: https://opensource.com/education/16/3/mattermost-open-source-chat
[6]: https://www.redhat.com/sysadmin/podman-run-pods-systemd-services?intcmp=7013a000002qLH8AAM
[7]: https://www.redhat.com/en/technologies/cloud-computing/openshift/aws?intcmp=7013a000002qLH8AAM
[8]: https://opensource.com/users/dboth
[0]: https://img.linux.net.cn/data/attachment/album/202304/02/135545u0rwtqdemqefme3e.jpg

View File

@ -0,0 +1,149 @@
[#]: subject: "How to Install and Use Neovim on Ubuntu and other Linux Distributions"
[#]: via: "https://itsfoss.com/install-neovim/"
[#]: author: "Anuj Sharma https://itsfoss.com/author/anuj/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15680-1.html"
如何安装和使用 Neovim
======
![][0]
> 你一定已经听说过著名的 Vim 文本编辑器。然而,这篇文章是关于它的复刻 Neovim。
Vim 也是 Vi 的一个复刻,这使得 Neovim 成为复刻的复刻。所以,你最终可以使用任何东西,因为它有一些独特的特征。
如果你决定使用 Neovim让我帮助你在 Ubuntu 和其他 Linux 发行版上开始使用它。
### Neovim 概述
![][2]
[Neovim][3] 是一个以其简单的维护和社区贡献而闻名的项目。此外,开发工作很好地分配在多个开发人员之间。
对于最终用户而言Neovim 的可扩展性远超人们的预期。Neovim 的目标是在不损害 Vim 传统功能的情况下提供更好的应用。
使用 [Neovim 的 GUI][4],你可以获得增强的编辑体验。
### Neovim 的特点
虽然你可以在其官方网站及其 [GitHub 页面][5] 上探索所有相关信息。让我强调一些特点:
- 现代图形界面
- 从多种语言访问 API包括C/C++、C#、Go、Haskell、Java/Kotlin、JavaScript/Node.js、Lua、Perl、Python、Ruby、Rust 等等)
- 嵌入式、可编写脚本的终端仿真器
- 异步任务控制
- 多个实例之间的共享数据
- XDG 基本目录支持
- 与大多数 Vim 插件兼容,包括 Ruby 和 Python 插件
> 💡 我们建议你在开始使用 Vim 和 Neovim 之前,先了解其用法。
### 在 Ubuntu 和 Linux 上安装 Neovim
由于 Neovim 的流行,安装它很简单。因为 Neovim 在你选择的任何发行版的官方仓库中都可用。
> 如果你需要,我们还有一个 [在 Linux 上安装 Vim][6] 的指南。
要在 Ubuntu 上安装 Neovim只需单击停靠区中的 Ubuntu 软件图标。然后,搜索 Neovim。你可以根据自己的喜好选择 Snap 或 deb 版本。但是deb 包版本是过时的 Neovim 版本。
![neovim listed on ubuntu software center][7]
如果你不想要 Snap 版本,你可以从 [Neovim 的 Github 发布页][8] 获取最新的 deb 文件。如果你仔细查看发布页面,还有一个 Appimage 文件。
如果你想使用终端而不是 GUI你可以执行以下操作
对于基于 **Ubuntu 和 Debian** 的发行版,输入以下命令进行安装:
```
sudo apt install neovim
```
对于 **Manjaro 和 Arch Linux**,使用以下命令更新你的系统并安装 Neovim
```
sudo pacman -Syu neovim
```
对于 **Fedora**,使用以下命令:
```
sudo dnf install -y neovim
```
要安装 **Flatpak**,你可以使用此命令:
```
flatpak install flathub io.neovim.nvim
```
最后,要安装 **Snap 包**,请使用以下命令:
```
sudo snap install nvim --classic
```
如果你更喜欢从源代码构建软件,请遵循该项目的 Github 页面上给出的 [步骤][9]。
### 如何使用 Neovim
要在安装完成后使用 Neovim只需从应用菜单启动它方法是按超级键并输入 `neovim`。这将打开一个带有 Neovim 的终端窗口。
![][10]
或者你可以打开你选择的任何终端仿真器并输入以下命令:
```
nvim
```
是的,不是 `neovim`,而是 `nvim`。例如,要编辑 `/etc/fstab`,请输入以下命令:
```
sudo nvim /etc/fstab
```
现在 fstab 文件将被打开,如下面的截图所示:
![][11]
如果你无法退出编辑器,请不要担心,按下 `Shift+Z+Z`。例如,如果此快捷键令人困惑,请使用你需要的键在任何文本编辑器中输入大写的 `ZZ` 就明白了。
关于这一点,我应该重申,你需要学习 Vim 或 Neovim 并阅读文档才能有效地利用其所有功能。
### 总结
安装和启动 Neovim 非常简单,但学习它肯定需要一些键盘操作。
这只是编辑器的概述。我不是这方面的专家,但我希望这对所有初学者都有好处!
💬 你使用 Neovim 吗? 在下面的评论中分享你的经验。
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-neovim/
作者:[Anuj Sharma][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/anuj/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/content/images/2023/03/linux-mega-packt.webp
[2]: https://itsfoss.com/content/images/2023/03/goneovim.png
[3]: https://neovim.io/?ref=itsfoss.com
[4]: https://itsfoss.com/neovim-gui-editors/
[5]: https://github.com/neovim/neovim?ref=itsfoss.com
[6]: https://itsfoss.com/install-latest-vim-ubuntu/
[7]: https://itsfoss.com/content/images/2023/01/software-center-neovim-snap.png
[8]: https://github.com/neovim/neovim/releases/tag/stable?ref=itsfoss.com
[9]: https://github.com/neovim/neovim/wiki/Installing-Neovim?ref=itsfoss.com#install-from-source
[10]: https://itsfoss.com/content/images/2023/01/neovim-default-screen.png
[11]: https://itsfoss.com/content/images/2023/01/neovim-fstab.png
[0]: https://img.linux.net.cn/data/attachment/album/202304/01/173733iav3pvd88htv38vt.jpg

View File

@ -0,0 +1,92 @@
[#]: subject: "blendOS Aims to Replace All Linux Distributions"
[#]: via: "https://news.itsfoss.com/blendos/"
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15684-1.html"
blendOS 的目标:取代所有的 Linux 发行版
======
> Ubuntu Unity 的负责人提出了一个新的发行版,听起来像是每个人都可能想要关注的东西。
![blend os][1]
听起来太牵强了?
好吧blendOS 把自己定位为发行版的终极杂拌。
blendOS 是 Rudra Saraswat 的一个新项目,他以基于 Ubuntu 的合成版而闻名,特别是 Ubuntu Unity现在是官方的 [Ubuntu 风味版][3])。
我想说的是,这个项目有一个非常准确的名字来表达它想要实现的目标。
但是blendOS 的目标是如何成为所有人的替代品?它到底是什么?
### blendOS 不只是又一个 Linux 发行版
![blendOS][4]
blendOS 是一个基于 Arch 的发行版,它支持每种类型的应用程序包。
如果你了解过 [carbonOS][5] 和 [Vanilla OS][6],你应该对这类发行版中的一些共同点有了了解。
其中之一是,**不可变性**,意思是,操作系统的核心/基础保持不变,给你带来增强的安全性,以及更简单和可靠的更新。
同样blendOS 也有以下的关键亮点:
- 不可变操作系统
- 支持多个软件包管理器,包括 Apt、DNF、Yum、Pacman 和 Yay
- 支持多种桌面环境
- Flathub 商店桌面应用
[blendOS][7] 使用 Jade GUI来自 [Crystal Linux][8] 的安装程序来提供一个无缝的安装体验。而且Flathub 商店可以直接安装应用程序,而不是像人们想象的那样下载 Flatpakref文件。
为了使所有的发行版的软件包都能正常工作blendOS 使用其软件包管理器 blend。
你仍然可以通过 Arch 容器在命令行使用 Pacman。
此外它还支持T2 Mac即 2018 年后生产的英特尔 Mac。因此如果你想在你已经拥有的设备上做实验blendOS 应该可以使用。
> 🚧 截至目前,该项目还处于早期发展阶段。
预计一些直接的变化包括:
![][9]
- 用 Podman 代替 Distrobox 的实现
- 一个新的 GUI 配置工具,支持管理覆盖层和容器
所以,是的,你现在看到的东西可能会有变化。然而,它仍然是听起来令人激动的东西。
你可以在其 [官方博客文章][10] 中阅读其计划中的变化,并在其 [GitHub 页面][11]中探索 blendOS。
> **[blendOS][7]**
你对 blendOS 有什么看法?它值得关注吗?请在评论中告诉我!
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/blendos/
作者:[Ankush Das][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lkxed/
[1]: https://news.itsfoss.com/content/images/size/w1304/2023/03/blendOS-first-look.png
[2]: https://news.itsfoss.com/content/images/2023/03/linux-mega-packt.webp
[3]: https://itsfoss.com/which-ubuntu-install/?ref=its-foss-news
[4]: https://news.itsfoss.com/content/images/2023/03/blend-os.jpg
[5]: https://news.itsfoss.com/carbonos/
[6]: https://news.itsfoss.com/vanilla-os-debian-ubuntu/
[7]: https://blendos.co/?ref=its-foss-news
[8]: https://news.itsfoss.com/crystal-linux-dev/
[9]: https://news.itsfoss.com/content/images/2023/03/blend-settings-containers.png
[10]: https://blendos.co/future-of-blendos/?ref=its-foss-news
[11]: https://github.com/blend-os?ref=its-foss-news

View File

@ -0,0 +1,138 @@
[#]: subject: "Create a ChatBot in Mattermost with Python"
[#]: via: "https://opensource.com/article/23/3/chatbot-mattermost-python"
[#]: author: "Dr. Michael J. Garbade https://opensource.com/users/drmjg"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15693-1.html"
使用 Python 在 Mattermost 中创建 ChatOps 聊天机器人
======
![][0]
> 用一个简单的开源机器人在你的组织中实施 ChatOps。
ChatOps 是一种协作模型,它将人员、流程、工具和自动化连接到一个透明的工作流中。[Mattermost][1] 是一个开源、自托管的消息平台,使组织能够安全、有效和高效地进行通信。它是 Slack、Discord 和其他专有消息平台的绝佳 [开源替代品][2]。本文概述了在 Mattermost 上创建 ChatOps 机器人的步骤,包括必要的代码示例和解释。
### 先决条件
在开始之前,请确保你可以访问 Mattermost 服务器,[安装 Python][3],并 [使用 pip][4] 安装 Mattermost Python 驱动。
### 在 Mattermost 上创建一个机器人帐户
要创建机器人帐户,请访问 Mattermost 系统控制台,并添加具有适当访问权限的机器人帐户。获取机器人的用户名和密码以在 Python 脚本中使用。
### 设置 Mattermost Python 驱动
使用 `pip` 安装 Mattermost Python 驱动,并将其导入 Python 脚本。创建一个新的驱动实例并登录到 Mattermost 服务器。
### 在 Python 中创建 ChatOps 机器人
创建一个新的 Python 脚本,定义要导入的必要库,并使用 Mattermost 驱动的 API 实现机器人的功能。编写代码来处理消息、命令和其他事件,并使用 Mattermost 驱动的 API 方法向通道和用户发送消息和通知。最后,调试和测试 ChatOps 机器人。
### ChatOps 机器人代码示例
以下是响应用户消息的简单 ChatOps 机器人的示例 Python 代码:
```
from mattermostdriver import Driver
bot_username = 'bot_username'
bot_password = 'bot_password'
server_url = 'https://your.mattermost.server.url'
def main():
driver = Driver({'url': server_url, 'login_id': bot_username, 'password': bot_password, 'scheme': 'https'})
driver.login()
team = driver.teams.get_team_by_name('team_name')
channel = driver.channels.get_channel_by_name(team['id'], 'channel_name')
@driver.on('message')
def handle_message(post, **kwargs):
if post['message'] == 'hello':
driver.posts.create_post({
'channel_id': post['channel_id'],
'message': 'Hi there!'
})
driver.init_websocket()
if __name__ == '__main__':
main()
```
### 添加功能
在 Mattermost 上创建基本的 ChatOps 机器人后,你可以添加更多功能来扩展其功能。以下是步骤:
- **确定要添加的功能**:在编写代码之前,你必须确定要添加到 ChatOps 机器人的功能。可以是从发送通知到与第三方工具集成的任何事情。
- **编写代码**:确定要添加的功能后,就可以开始编写代码了。代码将取决于添加的功能,但你可以使用 Mattermost Python 驱动与 Mattermost API 交互并实现该功能。
- **测试代码**:编写代码后,重要的是对其进行测试以确保其按预期工作。在将其部署到生产服务器之前,你可以在开发服务器或测试通道中测试代码。
- **部署代码**:当你对其进行了测试并且它按预期工作,你就可以将其部署到你的生产服务器。遵循你组织的部署流程并确保新代码不会破坏任何现有功能。
- **记录新功能**:记录你添加到 ChatOps 机器人的新功能非常重要。这将使其他团队成员更容易使用该机器人并了解其功能。
一个 ChatOps Bot 功能示例是与第三方工具集成并提供某些任务的状态更新。
```
from mattermostdriver import Driver
import requests
bot_username = 'bot_username'
bot_password = 'bot_password'
server_url = 'https://your.mattermost.server.url'
def main():
driver = Driver({'url': server_url, 'login_id': bot_username, 'password': bot_password, 'scheme': 'https'})
driver.login()
team = driver.teams.get_team_by_name('team_name')
channel = driver.channels.get_channel_by_name(team['id'], 'channel_name')
@driver.on('message')
def handle_message(post, **kwargs):
if post['message'] == 'status':
# Make a request to the third-party tool API to get the status
response = requests.get('https://api.thirdpartytool.com/status')
if response.status_code == 200:
status = response.json()['status']
driver.posts.create_post({
'channel_id': post['channel_id'],
'message': f'The status is {status}'
})
else:
driver.posts.create_post({
'channel_id': post['channel_id'],
'message': 'Failed to get status'
})
driver.init_websocket()
if __name__ == '__main__':
main()
```
在此示例中ChatOps 机器人监听命令 `status` 并向第三方工具 API 发出请求以获取当前状态。然后它会在发出命令的 Mattermost 频道中发布状态更新。这使团队成员无需离开聊天平台即可快速获取任务状态的更新。
### 开源 ChatOps
总之,在 Mattermost 上创建 ChatOps 机器人是一个简单的过程,可以为你组织的沟通和工作流程带来许多好处。本文提供了分步分解和代码示例,可帮助你开始创建你的机器人,甚至可以通过添加新功能对其进行自定义。现在你了解了基础知识,你可以进一步探索 ChatOps 和 Mattermost 以优化团队的协作和生产力。
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/chatbot-mattermost-python
作者:[Dr. Michael J. Garbade][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/drmjg
[b]: https://github.com/lkxed/
[1]: https://mattermost.com/
[2]: https://opensource.com/alternatives/slack
[3]: https://opensource.com/article/17/10/python-101
[4]: https://opensource.com/article/20/3/pip-linux-mac-windows
[0]: https://img.linux.net.cn/data/attachment/album/202304/05/092837ab3y8zft3hhv02hr.jpg

View File

@ -0,0 +1,189 @@
[#]: subject: "Debian 12 Bookworm: Best New Features"
[#]: via: "https://www.debugpoint.com/debian-12-features/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "robsean"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15694-1.html"
Debian 12 “Bookworm” 的新功能和改进
======
![][0]
> 让我们给你总结一下即将发布的 Debian 12 “Bookworm” 的新功能和改进。
Debian 12 已经开发了几个月了,并且正在慢慢走向最终的发布版本。截止发稿时, 它当前正处于冻结状态下。这意味着预计不会有重大的软件包更改或改进。
这个发布版本带来一些新功能和改进,使其成为 Debian 爱好者期待的一个版本。在这篇文章中,我们将讨论 Debian 12 “Bookworm” 的最好的新功能,以及它们如何使用户受益。
让我们来看看。
![Debian 12 Bookworm GNOME Desktop][1]
### Debian 12 “Bookworm” 的新功能和改进
#### Linux 内核
这个发布版本采用了发布于 2022 年 12 月的 Linux 主线内核 6.1。从时间线上看到目前为止Debian 12 的内核版本号只比最新内核落后一个版本。因此,你将通过使用稳定的 Linux 内核 6.1 来获得最新的和最好的硬件支持。
这个内核的亮点功能包括:初步支持 Rust 框架、更新支持英特尔和 AMD 即将推出的 CPU/GPU 系列硬件、改善 Btrfs 和其它文件系统系统的性能等等。
如果你想要了解更多的话,我们已经有一篇关于 [内核 6.1 特性][2] 的专题文章。
#### 在安装程序中的非自由软件包
在 Debian 12 中出现了一个与 Debian 的 ISO 文件有关的重大更改。最初Debian 就分别针对 “自由” 和 “非自由” 软件包提供了不同的 ISO 文件。专有的 “非自由” 软件包是单独的 ISO 文件的一部分。因此,如果你需要针对你的特殊硬件的驱动支持,那么你可以针对你的笔记本/台式机/服务器下载不同的 ISO 文件。
然而,这种体验使终端用户在选择恰当的 Debian 的 ISO 时感到迷惑。为此Debian 团队去年发起一次社区投票,以选出如何处理 “非自由” 的最好的选项。
根据 [选出的结果][3] , 现在,基本的 ISO 文件现在包含 “自由” 和 “非自由” 的软件包。
那么,发生了什么变化?
在我们尝试现在官方的 Debian 的 ISO 文件时,你只需要选择一个包含所有东西的 ISO 文件 DVD 大小的体积)。此外,也提供小型的网络安装的 ISO 文件,包含 “非自由” 固件。
你可以查看关于 Debian 的 ISO 文件的 [这篇指南][4] 。
#### GNOME 在默认情况下使用 Pipewire
如果你在 Debian Linux 中使用 GNOME 桌面环境,那么,给你带来一个好消息。
Debian 12 和 GNOME 桌面环境 [在默认情况下,使用 Pipewire 和 Wireplumber 管理器][5] 作为声音服务器,取代了 Pulseaudio 。现代化的 Pipewire 早就已经引入 Ubuntu 、Fedora 、Pop!_OS 等其它领先的发行版。
![Pipewire in Debian 12][6]
#### 新版本的 Apt 软件包管理器2.6
Debian 12 引入 Apt 软件包管理器的最新的版本。[Apt 2.6][7] 版本专门处理了这个版本中引入的非自由 ISO 镜像支持。这些更改包含默认启用非自由固件Apt 将显示非自由软件包的更新。
#### 桌面环境
在 Debian 12 中,除 GNMOE 桌面环境外,所有的主流桌面环境都是最新的。这是因为 [GNOME 44][8] 才刚刚发布,由于工作日程计划不一样,因此它没有进入 “Bookworm” 。Debian 12 已经处于硬冻结状态。
因此,在 Debian 12 中,你将得到 [GNOME 43][9] 版本,与最新的发布版本相比,它也没有落后多少。此外,如果你从 [Debian 11][10] 转换而来,那么,这将是一次重大的 GNOME 升级。
幸运的是,[KDE Plasma 5.27][11] 现在可以在这个发布版本中使用了。KDE Plasma 是 Plasma 5 的最终版本,并且在 Plasma 6 版本准备好之前,它可能会成为 LTS 。因此它是一次重要的升级。KDE Plasma 维护人员成功地实现了这一目标。
另外,在 Debian 12 中的 [Xfce 4.18][12] 通过令人惊艳的 Thunar 的特色功能带来了更好的桌面体验。此外,在 Debian 12 中LXQt 1.2 、MATE 1.26 和 LXDE 11 都是最新的版本。
这里有一份摘要:
- GNOME 43
- KDE Plasma 5.27
- LXDE 11
- LXQt 1.2
- MATE 1.26
- Xfce 4.18
#### 核心模块和应用程序
大多数主要的应用程序都已经刷新版本。尤其是Python 3.11 已经包含在 Debian 12 中这将有助于帮助开发者和很多使用情况。此外LibreOffice 7.4 和 Firefox 102.9 ESR 也是两个重要的更新。这里有一份关于主要应用程序和软件包升级的小列表:
- LibreOffice 7.4.4
- Firefox 102.9 ESR
- GIMP 2.10.32
- OpenJDK 11.6
- PHP 8.2
- Python 3.11+
- Samba 4.17
#### 杂项更新
- Debian 12 现在在双启动设置时可以检测到 Windows 11
- 在 Debian 和 Cinnamon 桌面环境中,默认启用支持屏幕阅读器
- 在 30 秒超时后,自动启动语音合成
- 更容易地检测多路径设备
- 支持多个 initrd 路径
- 支持新的 ARM 和 RISC-V 设备
- 放弃实验性的 DMRAID 支持
你可以 [在这里][13] 了解更多的变化。
#### 默认的主题和墙纸
在每一次发布版本中Debian 都会从引入一些来自社区的令人惊叹的艺术作品。Debian 12 以 “<ruby>绿宝石<rt>Emerald</rt></ruby>” 作为默认的艺术作品主题。
“_经过抛光和凿刻或在它们原始和纯天然的状态下宝石可以有无限的形状。”_
通过 Emerald 主题,创建者希望将光线与矿物质以一种简洁至近乎空灵的设计结合在一起。
默认主题和横幅可以在安装程序、动画 Plymouth 、壁纸等所有的位置都可以看到。
这里是一些选自 [官方画廊][14] 的图片。
![Default wallpaper][15]
![Debian 12 Plymouth][16]
### 如何下载 Debian 12
**注意**: Debian 12 尚未发布稳定版本。因此,不要在正式工作中使用它,也不要从 Bullseye 升级到 “Bookworm” 。
如果你正在运行 Debian 11 “Bullseye” ,你可以通过任意的文本编辑器来打开 `/etc/apt/sources.list` ,并添加下面的命令行。务必验证镜像 URL ,并更改下面的命令行。
```
deb http://http.us.debian.org/debian bookworm main non-free contrib
deb http://security.debian.org/ bookworm/updates main contrib non-free
deb http://http.us.debian.org/debian sid main non-free contrib
```
在添加这些命令行后,刷新 `apt` 缓存:
```
sudo apt update
```
接下来,运行下面的命令行来获取更新:
```
sudo apt dist-upgrade
```
下载全新的 ISO 文件,访问任意一个下面的链接。
> **[下载 Debian 12 (DVD) ISO Alpha2][17]**
### 总结
总而言之Debian 12 “Bookworm” 是一个令人印象深刻的版本,带来了一些新的特色功能和改善。从最新的桌面环境到新内核和更新的软件包,这个发布版本为新用户和有经验的 Debian 用户都提供了很多东西。
因为它专注于稳定性、安全性和开源原则,所以,对于那些寻求替换 Ubuntu 和通用操作系统的人来说Debian 12 “Bookworm” 可能是最好的选择。
这个版本的最终版本预期在 2023 年第二季度发布。
> **[Debian 12 更改日志(有点过时了)][18]**
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/debian-12-features/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/wp-content/uploads/2023/03/Debian-12-Bookworm-GNOME-Desktop.jpg
[2]: https://www.debugpoint.com/linux-kernel-6-1/
[3]: https://lists.debian.org/debian-vote/2022/10/msg00000.html
[4]: https://www.debugpoint.com/download-debian-iso/
[5]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020249
[6]: https://www.debugpoint.com/wp-content/uploads/2023/03/Pipewire-in-Debian-12.jpg
[7]: https://launchpad.net/ubuntu/+source/apt/+changelog
[8]: https://www.debugpoint.com/gnome-44/
[9]: https://www.debugpoint.com/gnome-43/
[10]: https://www.debugpoint.com/debian-11-features/
[11]: https://www.debugpoint.com/kde-plasma-5-27/
[12]: https://www.debugpoint.com/xfce-4-18-review/
[13]: https://lists.debian.org/debian-devel-announce/2022/09/msg00004.html
[14]: https://wiki.debian.org/DebianArt/Themes/Emerald
[15]: https://www.debugpoint.com/wp-content/uploads/2023/03/Default-wallpaper.jpg
[16]: https://www.debugpoint.com/wp-content/uploads/2023/03/Debian-12-Plymouth.jpg
[17]: https://cdimage.debian.org/cdimage/bookworm_di_alpha2/amd64/iso-dvd/
[18]: https://www.debian.org/releases/bookworm/amd64/release-notes/ch-whats-new.en.html
[0]: https://img.linux.net.cn/data/attachment/album/202304/05/112008tjogt4q224g49tj4.jpg

View File

@ -0,0 +1,242 @@
[#]: subject: "10 Tweaks to Supercharge Gedit as Code Editor"
[#]: via: "https://itsfoss.com/gedit-tweaks/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-15688-1.html"
将 Gedit 作为代码编辑器的 10 项增强调整
======
![][0]
> Gedit 是一个好的文本编辑器。用这些技巧、窍门和调整把它变成一个好的代码编辑器。
GNOME 可能已经抛弃了 Gedit 作为默认的文本编辑器,但它仍然是 Linux 老用户的最爱。
它主要是一个文本编辑器,但通过一些调整,它可以作为一个轻量级的代码编辑器使用。
是啊!为什么要用 VS Code 或其他专门的代码编辑器来编写 Bash 脚本或其他语言的简单程序?用 Gedit 也可以过一天。
我将在本文中分享一些我最喜欢的 Gedit 技巧和窍门。虽然大多数的调整对写代码是有益的,但有些对一般的文本写作也是有帮助的。
### 1、安装插件
可能个别人甚至不知道 Gedit 有强大的插件功能。你可以安装插件来获得额外的功能。
有两种类型的插件:
- 可以从编辑器菜单中访问的官方 Gedit 插件
- 第三方插件,可以从项目网站上下载,并放入插件目录中(下面讨论)。
Gedit 插件可以放在 `/usr/share/gedit/plugins``~/.local/share/gedit/plugins` 目录下。
![][2]
你可以通过点击 “汉堡包” 菜单,然后打开 “<ruby>首选项<rt>Preferences</rt></ruby>” 窗口来访问可用和已安装的插件。
![][3]
首选项窗口有 “<ruby>插件<rt>Plugins</rt></ruby>” 标签,你可以看到所有可用的插件。你可以使用复选框来启用和禁用这些插件。
![][4]
### 2、在侧边栏中显示文件浏览器
如果你正在处理一个有多个文件和文件夹的项目,在侧边栏中用文件浏览器看到所有可用的文件是相当有用的。
进入 “首选项” -> “插件”,启用 “<ruby>文件浏览器面板<rt>File Browser Panel</rt></ruby>”。
![][5]
之后,点击右上角的汉堡包菜单,从菜单 “<ruby>查看<rt>View</rt></ruby>” -> “<ruby>侧面板<rt>Side Panel</rt></ruby>” 启用侧面板视图。
现在把侧面板视图改为文件浏览器,如果还没有的话。
![][6]
### 3、嵌入一个终端
是的!你可以在 Gedit 文本编辑器中直接嵌入一个终端。
这有什么意义呢?嗯,如果你正在写程序或脚本,嵌入终端可以帮助你运行脚本,并在编辑器中检查代码的变化。
![][7]
要得到这个,首先要安装这个插件(针对 Ubuntu
```
sudo apt install gedit-plugin-terminal
```
一旦插件安装完毕,从 “首选项” -> “插件” 中启用它。
![][8]
嗯,从汉堡包菜单-> “查看”-> “<ruby>底部面板<rt>Bottom Panel</rt></ruby>” 中启用底部面板。
![][9]
### 4、Markdown 预览
喜欢 Markdown 吗?我也是!
有几个适用于 Linux 的 Markdown 编辑器,但你不必为了使用 Markdown 而去安装另一个应用程序。
在一个名为 “[Gedit Markdown Preview][10]” 的插件的帮助下Gedit 完全有能力呈现 Markdown 代码。
Arch 用户可以在 AUR 中找到它,软件包为 `gedit-plugin-markdown_preview`
其他 Linux 用户可以找到 [项目网页上的安装说明][11]。
一旦安装,在插件中启用它。你必须从汉堡包菜单 -> “查看”-> “侧面板” 中启用侧面板视图。
![][12]
有了这个,它就开始在侧面板或底部窗格中显示 Markdown 文本的渲染文本。
![][13]
### 5、创建代码片段
*好的码农编码,优秀码农复用。*
如果你发现自己重复使用同一段代码或文本,你可以将其保存为片段,并在需要时插入。这将为你节省一些时间(和挫折)。
先启用片段插件:
![][14]
现在你可以从汉堡包菜单-> “<ruby>管理片段<rt>Manage Snippets</rt></ruby>” 来访问片段。
![][15]
你会发现它已经有几个为各种编程语言添加的片段。
![][16]
你也可以通过点击左下角的 “+” 号将你的片段添加到所需的文件夹中。你也可以为片段指定一个快捷键,以便更快速地插入它们。
![][17]
例如,我为 [添加一个 Markdown 表格][18] 添加了一个新的片段,并为其分配了一个键盘快捷键和 TAB 触发器(如上图所示)。现在,如果我在 Markdown 文档中按 `CTRL + Alt + S`,就会添加一个表格。或者,输入 `table` 并按下 `TAB` 键也会添加 Markdown 表格。
> 💡 通常,片段被保存在 `/usr/share/gedit/plugins/snippet` 文件夹中作为 XML 文档,但我找不到新添加的片段被保存在哪里。
### 6、修复深色模式的问题
编码员喜欢深色模式。Gedit 遵守系统主题,如果你在操作系统层面切换到深色模式,它也会切换到深色模式。
一个主要的问题是,你无法阅读当前选定行的任何内容,因为文本和行的高亮部分都是白色的。
![][19]
这个问题没有解决办法。然而,一个变通的办法是,要么禁用当前行的高亮显示,要么使用不同的颜色方案。
进入 “首选项” -> “<ruby>字体和颜色<rt>Font & Colors</rt></ruby>”,然后选择像 Oblivion 这样的深色方案。这将稍微改变颜色方案,但至少你能看到高亮行的文字。
![][20]
### 7、快速高亮选中的文本
双击一个词Gedit 就会高亮显示整个文档中出现的所有相同的词。
![][21]
虽然有一个官方插件,但这个功能默认是不启用的。
进入 “首选项” -> “插件”,启用 “<ruby>快速高亮<rt>Quick Highlight</rt></ruby>” 选项。
![][22]
### 8、显示行号
许多代码编辑器默认都会显示行号。当你看到 “第 X 行的语法错误 ” 时,它可以帮助你快速找到该行。
你可以通过进入 “首选项” -> “查看” -> “<ruby>显示行号来启用行号<rt>Display Line Numbers</rt></ruby>”:
![][23]
你也可以从底部启用或停用它。
![][24]
### 9、保存一个版本
如果你正在修改一个文件也许建立一个备份副本会更好Gedit 可以自动做到这一点。
在 “首选项” -> “<ruby>编辑器<rt>Editor</rt></ruby>” -> “<ruby>创建一个备份副本<rt>Create a Backup copy</rt></ruby>” 中启用这个功能。
![][25]
一个在原文件名称后面加上 `~` 符号的文件将作为备份文件出现。
![][26]
### 10、自动保存文件
既然我们在谈论版本和备份,那么 [在 Gedit 中启用自动保存][27] 怎么样?这样,如果你在处理一个文件时,忘记用 `Ctrl+S` 手动保存,修改的内容会自动保存。
> 🚧 这个功能对一个从未在磁盘上保存过的全新文档不起作用。
从 “偏好” -> “编辑器”,你可以启用 “<ruby>自动保存<rt>Autosave</rt></ruby>” 功能。默认情况下,它每 10 分钟自动保存一次,但你可以根据自己的喜好改变时间。
![][28]
还有一个第三方的 [smart-auto-save 扩展][29],可以在你停止输入时自动保存文档。
![][30]
### 知道更多的 Gedit 技巧吗?
使用任何软件的乐趣之一是发现它不那么明显的功能。
在这里,你最喜欢哪个 Gedit 的调整?你知道一个没有多少人知道的 Gedit 的秘籍吗?在评论中与我们分享吧?
--------------------------------------------------------------------------------
via: https://itsfoss.com/gedit-tweaks/
作者:[Abhishek Prakash][a]
选题:[lkxed][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/content/images/2023/03/linux-mega-packt.webp
[2]: https://itsfoss.com/content/images/2023/03/PLUGIN-INSTALL-gedit-plugin-saved-to-the-directory.png
[3]: https://itsfoss.com/content/images/2023/03/ACCESS-PREFERENCES.png
[4]: https://itsfoss.com/content/images/2023/03/PLUGIN-INSTALL-plugins-in-prefereneces.png
[5]: https://itsfoss.com/content/images/2023/03/FILE-BROWSER-file-browser-plugin-in-preferences.png
[6]: https://itsfoss.com/content/images/2023/03/FILE-BROWSER-file-browser-as-a-side-pane.png
[7]: https://itsfoss.com/content/images/2023/03/TERMINAL-gedit-embedded-terminal.png
[8]: https://itsfoss.com/content/images/2023/03/TERMINAL-embedded-terminal-plugin-in-plugins-tab.png
[9]: https://itsfoss.com/content/images/2023/03/TERMINAL-enable-bottom-panel-for-embedded-terminal.png
[10]: https://github.com/maoschanz/gedit-plugin-markdown_preview?ref=itsfoss.com
[11]: https://github.com/maoschanz/gedit-plugin-markdown_preview?ref=itsfoss.com#installation
[12]: https://itsfoss.com/content/images/2023/03/ENABLE-SIDE-PANEL.png
[13]: https://itsfoss.com/content/images/2023/03/MARKDOWN-PREVIEW-markdown-preview.png
[14]: https://itsfoss.com/content/images/2023/03/ENABLE-SNIPPET-PLUGLIN.png
[15]: https://itsfoss.com/content/images/2023/03/ACCESS-MANAGE-SNIPPET.png
[16]: https://itsfoss.com/content/images/2023/03/SNIPPET-pre-created-snippets-in-gedit-showing-cpp-main-snippet.png
[17]: https://itsfoss.com/content/images/2023/03/adding-a-custom-markdown-table-snippet.png
[18]: https://itsfoss.com/markdown-table/
[19]: https://itsfoss.com/content/images/2023/03/DARK-MODE-ISSUE-text-not-visible-in-highlight-line.png
[20]: https://itsfoss.com/content/images/2023/03/DARK-MODE-ISSUE-settting-a-new-clor-scheme-to-the-dark-mode-font-issue.png
[21]: https://itsfoss.com/content/images/2023/03/QUICK-HIGHLIGHT-result.png
[22]: https://itsfoss.com/content/images/2023/03/QUICK-HIGHLIGHT-already-available-plugin-no-external-needed.png
[23]: https://itsfoss.com/content/images/2023/03/LINE-NUMBER-display-line-numbers-in-gedit.png
[24]: https://itsfoss.com/content/images/2023/03/SHOW-LINE-NUMBERS.png
[25]: https://itsfoss.com/content/images/2023/03/SAVE-BACKUP.png
[26]: https://itsfoss.com/content/images/2023/03/VERSION-in-file-manager.png
[27]: https://itsfoss.com/how-to-enable-auto-save-feature-in-gedit/
[28]: https://itsfoss.com/content/images/2023/03/AUTO-SAVE-files-the-built-in-save-function-that-saves-the-document-after-some-time.png
[29]: https://github.com/seanh/gedit-smart-autosave/?ref=itsfoss.com
[30]: https://itsfoss.com/content/images/2023/03/AUTO-SAVE-Smart-auto-save.png
[31]: https://itsfoss.com/flatpak-tips-tweaks/
[0]: https://img.linux.net.cn/data/attachment/album/202304/03/163721ts31zsxhs1wuwp63.jpg

View File

@ -0,0 +1,111 @@
[#]: subject: "Linux Lite 6.4 Gets Lighter With More Features like WebP Image Support"
[#]: via: "https://news.itsfoss.com/linux-lite-6-4-released/"
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Linux Lite 6.4 Gets Lighter With More Features like WebP Image Support
======
Linux Lite 6.4 is a neat upgrade with a couple of new changes!
![linux lite 6.4][1]
![][2]
Linux Lite is known for its lightweight and Windows-like layout that provides users with a familiar operating system experience.
The last major release, [Linux Lite 6.2][3] saw the inclusion of various user interface tweaks/bug fixes, and now another release is here that also has various improvements on offer.
Let me take you through the Linux Lite 6.4 release.
### 🆕 Linux Lite 6.4: What's New?
![a screenshot of the desktop on linux lite 6.4][4]
Based on **[Ubuntu 22.04.2 LTS][5]**, this release has some interesting new additions, here are the highlights that you should know about:
- **SystemD reporting via Lite System Report**
- **ZSTD Compression**
- **Better WebP Support**
- **Updated Thunderbird**
- **Xfce 4.18**
#### SystemD reporting via Lite System Report
![a screenshot of the systemd report on linux lite 6.4][6]
As you know that **systemd is one of the basic building blocks of a Linux system** that starts the boot procedure for the rest of the system.
Linux Lite 6.4 has bought about a dedicated reporting option for systemd errors. This will make it easy to pinpoint booting and general system issues via the Lite System Report tool.
#### ZSTD Compression
The complete Lite app suite (their in-house apps) has been repackaged using ZSTD compression for faster decompression and better compression, resulting in a **lighter storage footprint**.
For example: Now the Lite Themes app is **76.8 MB** instead of the more hefty **91.2 MB**.
Systems with slower processors will benefit a great deal due to the inclusion of this, resulting in significantly faster application update times.
#### Better WebP Support
![a screenshot of the webp thumbnail support on linux lite 6.4][7]
The Thunar file manager has been **updated to****4.16.10** and can now show thumbnails for WebP files correctly, instead of a generic placeholder image.
This should make it easy for you to go through your WebP files, without the need to open them one-by-one.
#### Updated Thunderbird
![a screenshot of thunderbird 102 running on linux lite 6.4][8]
Linux Lite 6.4 **features Thunderbird 102** with its redesigned icons, the central spaces' toolbar, new address book, import/export wizard, matrix chat support and more.
You can read more about it in our article to dive deeper.
#### 🛠️ Other Changes
Other than the above-mentioned, here are a few application suite updates that are worth mentioning:
- **Linux Kernel 5.15.0-69**
- **Chrome 111.0**
- **LibreOffice 7.4.6.2**
- **VLC 3.0.16**
- **Gimp 2.10.30**
- **The latest [Papirus][9] icon theme set.**
If you are curious about the latest Xfce 4.18, you can check out our separate coverage to explore the details:
### 📥 Get Linux Lite 6.4
The ISO for Linux Lite 6.4 can be sourced from the [official website][10], or by clicking on the download button below.
[Linux Lite 6.4 (OSDN)][11]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/linux-lite-6-4-released/
作者:[Sourav Rudra][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/sourav/
[b]: https://github.com/lkxed/
[1]: https://news.itsfoss.com/content/images/size/w1304/2023/04/linux-lite-6-4-released.jpg
[2]: https://news.itsfoss.com/content/images/2023/03/linux-mega-packt.webp
[3]: https://news.itsfoss.com/linux-lite-6-2-release/
[4]: https://news.itsfoss.com/content/images/2023/04/Linux_Lite_6.4.png
[5]: https://fridge.ubuntu.com/2023/02/24/ubuntu-22-04-2-lts-released/?ref=its-foss-news
[6]: https://news.itsfoss.com/content/images/2023/04/Linux_Lite_6.4_2.png
[7]: https://news.itsfoss.com/content/images/2023/04/Linux_Lite_6.4_3.png
[8]: https://news.itsfoss.com/content/images/2023/04/Linux_Lite_6.4_4.png
[9]: https://github.com/PapirusDevelopmentTeam/papirus-icon-theme?ref=its-foss-news
[10]: https://www.linuxliteos.com/download.php?ref=its-foss-news
[11]: https://osdn.net/projects/linuxlite/storage/6.4/?ref=its-foss-news

View File

@ -2,7 +2,7 @@
[#]: via: "https://opensource.com/article/22/10/whats-new-awk"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lkxed"
[#]: translator: "connermemory"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "

View File

@ -1,146 +0,0 @@
[#]: subject: "Essential tips and tricks for your first tech job"
[#]: via: "https://opensource.com/article/23/2/your-first-tech-job"
[#]: author: "Fatima https://opensource.com/users/ftaj"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Essential tips and tricks for your first tech job
======
First days at work are scary. I still recall many instances where I lay awake at night before my first day at work, having an internal meltdown over what would happen the next day. Starting a new job is uncharted territory for most people. Even if you're a veteran in the industry, there's no denying that there can be a part of you that's a bit terrified of what is to come.
Understandably, a lot is happening. There are new people to meet, new projects and technologies to understand, documentation to read, tutorials to sit through, and endless HR presentations and paperwork to fill out. This can be overwhelming and, coupled with the considerable degree of uncertainty and unknowns you're dealing with, can be quite anxiety-inducing.
Two reasons motivated me to write about this subject. The first one being that back when I was a student, most of the discussion revolved around getting a job in tech, and no one talked about what happened next. How do you excel in your new role? Now that I look back, I think I assumed that the hard part is getting the job, and whatever comes after, I could probably figure out myself.
Similarly, once I started working in the industry, most of the career-related content I came across was about how to go from one senior level to another. No one really talked about what to do in the middle. What about the interns and the junior engineers? How do they navigate their early careers?
After completing three years of full-time professional experience as a software engineer (and a couple of internships before), I reflected on my time. I put together a list of tips and tricks I've employed while settling into a new tech role. I wanted to look beyond just the first couple of months and prioritize helping achieve long-term success.
### Reflect on existing processes and documentation
Most new employees start by either having a ton of documentation thrown their way or none at all. Instead of being overwhelmed by either of these possibilities, you could view this as an opportunity.
Identify gaps in existing documentation and think about how you could improve it for the next engineer that gets onboarded. This not only shows initiative on your part but also demonstrates that you're committed to improving existing processes within your team.
I've seen both ends of the spectrum. I've been on teams with no documentation whatsoever. I've also been on teams that were very diligent with keeping their documentation up to date. Your path is pretty straightforward with the former, and you can work on creating that missing documentation. With the latter, you can always think of ways to improve what already exists. Sometimes, too much documentation in written form can also feel intimidating, especially for new employees. Some things might be better explained through other mediums, like video tutorials or screencasts.
### Ask questions
I encourage you to look into whether a buddy will be assigned to you when you're starting. This is a fairly common practice at companies. The purpose of a buddy is to help you as you are onboarded. I've found this incredibly helpful because it gives you someone to direct all your questions, and you don't have to run around trying to find the right person/team.
While asking questions should always be encouraged, it is also necessary to do your homework before you ask those questions, including:
- Do your research. This encompasses doing a web search, checking forums, and reading existing documentation. Use all the available tools at your disposal. However, it is essential to timebox yourself. You must balance doing your due diligence and keeping project deadlines and deliverables in mind.
- Talk it out. As someone whose first language isn't English, I recommend talking things out loud before asking questions. In my experience, I've often found that, especially when I'm struggling with something difficult, I think in one language (probably my native language) and must explain it in another. This can be a bit challenging sometimes because doing that translation might not be straightforward.
- Organize your thoughts. When struggling with something, it's very common to have many scrambled ideas that make sense to us but might not necessarily make sense to another person. I suggest sitting down, gathering your thoughts, writing them down, and talking through them out loud. This practice ensures that when you're explaining your thought process, it flows as intended, and the listener can follow your train of thought.
This approach is called the rubber duck technique, a common practice developers use while debugging. The concept is that sometimes explaining your problem to a third person can be very helpful in getting to the solution. This is also a testament to your excellent communication skills.
Respect people's time. Even if you're reaching out to someone like your buddy, be cognizant of the fact that they also have their day-to-day tasks to complete. Some things that I've tried out include the following:
- Write down my questions and then set aside some time with my mentor so I could talk to them.
- Compile questions instead of repeatedly asking for help so your mentor can get to them when they have time.
- Schedule a quick 15-20 min video chat, especially if you want to share your screen, which is a great way to showcase your findings.
I think these approaches are better because you get someone's undivided attention instead of bothering them every couple of minutes when their attention might be elsewhere.
### Deep dive into your projects
Even on teams with excellent documentation, starting your technical projects can be very daunting since multiple components are involved. Over time though, you will understand how your team does things. However, it can save you time and potential headaches to figure this out early on by keeping a handy list to refer to, including basic project setup, testing requirements, review and deployment processes, task tracking, and documentation.
If there's no documentation for the project you're starting on (a situation I have been in), see if you can identify the current or previous project owner and understand the basic project structure. This includes setting it up, deploying it, etc.
- Identify your team's preference in the IDE (integrated development environment). You're free to use the IDE of your choice, but using the same one as your team can help, especially when debugging, since the choice of IDE impacts debugging. Different IDEs offer varying degrees of debugging support.
- Understand how to do debugging, and I don't just mean using print statements (not that there's anything wrong with that approach). Leverage your team's experience here!
- Understand testing requirements. This might depend on the scope of your project and general team practices, but the earlier you figure this out, the more confident you'll be in the changes you push to production.
- Visualize the deployment process. This process can vary by team, company, etc. Regardless of how informal or formal it may be, make sure you understand how your changes get deployed to production, what the deployment pipeline looks like, how to deploy changes safely, what to do in case of failed builds, how to rollback faulty changes, and how to test your changes in production.
- Understand the ticketing process. Understand how to document tickets and the level of detail expected. You will see a lot of variation here. Some companies expected us to submit our tickets daily, showing our progress. Other companies might not require that level of documentation.
Given everything I just mentioned, a beneficial, all-in-one exercise you can do in the first couple of weeks is to shadow another engineer and do peer coding sessions. This allows you to observe the entire process, end to end, from the moment a ticket is assigned to an engineer to when it gets deployed to production.
The first couple weeks can also feel frustrating if you're not yet given an opportunity to get your hands dirty. To counter this, ask your manager to assign some starter tickets to you. These are usually minor tasks like code cleanup or adding unit tests. Still, they allow you to tinker with the codebase, which helps improve your understanding and gives you a sense of accomplishment, which is a very encouraging feeling in the early days of a new job.
### Speak up, especially when you're stuck
I want to stress the importance of communication when you're stuck. This happens, especially in the early months of a new job, and as frustrating as it can be, this is where your communication skills will shine.
- Be transparent about blockers and your progress. Even if it's something as trivial as permission issues (a fairly common blocker for new employees), ensure that your manager is aware.
- Don't wait until the last day to report if something will be delayed. Delays in your project push many other things forward. Share necessary project delays well in advance, so your manager can share this with stakeholders.
- Don't forget things like thoroughly testing your changes or documenting your code just because you're in a rush.
### Gain technical context
Gaining technical context is something I've personally struggled with, and I've actively worked on changing my approach in this area.
When I started as an intern, I would go in with a very focused mindset regarding what I wanted to learn. I'd have a laser-sharp focus on my project, but I'd completely turn a blind eye to everything else. Over the years, I realized that turning a blind eye to other or adjacent projects might not be the wisest decision.
First and foremost, it impacts your understanding of your work. I was naive to think I could be a good engineer if I focused exclusively on my project. That's just not true. You should take the time to understand other services with which your project might interact. You don't need to get into the nitty gritty, but developing a basic understanding goes a long way.
A common experience that new employees undergo is disconnecting from the rest of the company, which is a very natural feeling, especially at larger companies. I'm someone who develops a sense of exclusion very quickly, so when I moved to Yelp, a significantly larger company than my previous one, with projects of a much larger scale, I prioritized understanding the big picture. Not only did I work on developing an understanding of my project but also of other adjacent projects.
In my first few weeks at Yelp, I sat down with various engineers on my team and asked them to give me a bird's eye view of what I would be doing and the project's overarching goal. This approach was incredibly helpful because not only did I get varying degrees of explanations based on how senior the engineer was and how long they had been working on the project, but it also deepened my understanding of what I would be working on. I went into these meetings with the goal that my knowledge of the project should allow me to explain what I do to a stranger on the street. To this end, I asked my tech lead to clarify at what point my work came into the picture when a user opened the Yelp app and searched for something.
Architecture diagrams can also help in this scenario, especially when understanding how different services interact.
### Establish expectations
For the longest time, I thought that all I needed to do was my best and be a good employee. If I was doing work, meeting goals, and no one complained, that should be good enough, right? Wrong.
You must be strategic with your career. You can't just outsource it to people's goodwill and hope you'll get the desired results just because you're meeting expectations.
- Establish clear criteria the moment you start your new job. This varies by company, as some organizations have very well-defined measures while others might barely have any. If it's the latter, I suggest you sit down with your manager within the first couple of weeks and establish and unanimously agree on a criterion.
- Make sure you thoroughly understand how you will be evaluated and what measures are used.
I remember walking out of my first evaluation very confused in my first full-time role. The whole conversation had been very vague and hand-wavy, and I had no clarity about my strengths, weaknesses, or even steps to improve.
At first, it was easy to attribute everything to my manager because the new employee in me thought this was their job, not mine. But over time, I realized that I couldn't just take a backseat as far as my performance evaluations were concerned. You can't just do good work and expect it to be enough. You have to actively take part in these conversations. You have to make sure that your effort and contributions are being noticed. From regularly contributing to technical design conversations to setting up socials for your team, ensure that your work is acknowledged.
Tying into establishing expectations is also the importance of actively seeking feedback. Don't wait until your formal performance evaluations every three or four months to find out how you're doing. Actively set up a feedback loop with your manager. Try to have regular conversations where you're seeking feedback, as scary as that may be.
### Navigate working in distributed teams
The workplace has evolved over the past two years, and working in remote and distributed teams is now the norm instead of a rarity. I've listed some tips to help you navigate working in distributed teams:
- When starting meetings, exchange pleasantries and ask people how their weekend/day has been. This helps break the ice and enables you to build a more personal connection with your team members, which goes beyond work.
- Suggest an informal virtual gathering periodically for some casual chit-chat with the team.
- Establish core hours and set these on your calendar. These are a set of hours that your team will unanimously agree upon, and the understanding is that everyone should be online and responsive during these hours. This is also convenient because meetings only get scheduled within these hours, making it much easier to plan your day.
- Be mindful of people's time zones and lunch hours.
- In the virtual world, you need to make a greater effort to maintain social interactions, and little gestures can go a long way in helping make the work environment much friendlier. These include the following:
### Maintain a work-life balance
At the beginning of your career, it's easy to think that it's all about putting in those hours, especially given the 'hustle culture' narrative that we're fed 24/7 and the idea that a work-life balance is established in the later stages of our careers. This idea couldn't be further from the truth because a work-life balance isn't just magically going to occur for you. You need to actively and very diligently work on it.
The scary thing about not having a work-life balance is that it slowly creeps up on you. It starts with you checking emails after hours and then slowly makes its way to you, working over weekends and feeling perpetually exhausted.
**[ Related read [How I recognize and prevent burnout in open source][1] ]**
I've listed some tips to help you avoid this situation:
- Turn off/pause notifications and emails and set yourself to offline.
- Do not work weekends. It starts with you working one weekend, and the next thing you know, you're working most weekends. Whatever it is, it can wait until Monday.
- If you're an on-call engineer, understand your company's policies surrounding that. Some companies offer monetary compensation, while others may give time off in lieu. Use this time. Not using your benefits like PTO (paid time off) and wellness days really shortens your longevity at work.
### Wrap up
There's no doubt that starting a new job is stressful and difficult. I hope that these tips and tricks will make your first few months easier and set you up for great success with your new position. Remember to communicate, establish your career goals, take initiative, and use the company's tools effectively. I know you'll do great!
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/2/your-first-tech-job
作者:[Fatima][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/ftaj
[b]: https://github.com/lkxed/
[1]: https://opensource.com/article/21/5/open-source-burnout

View File

@ -0,0 +1,110 @@
[#]: subject: "The power of sisterhood and allyship in open source"
[#]: via: "https://opensource.com/article/23/3/power-sisterhood-allyship-open-source"
[#]: author: "Paloma Oliveira https://opensource.com/users/discombobulateme"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
The power of sisterhood and allyship in open source
======
A little more than two years ago, I switched my career from artist to [software developer][1]. I didnt do it alone. I had the support of PyLadies Berlin, the local Berlin chapter of an international volunteer-based group made to support women in technology.
We are used to the term “career change” as if it were a break in a trajectory. But in my experience, thats never really the case. A person cannot erase themselves from what they consist of, and this richness of diverse backgrounds resulted in several breaking points. Individual journeys, often far from computer science, hold accountability for the social implication of technology and bring richness and creativity to the technology industry.
Being an artist has always given me freedom and opened doors to explore several fields, from architecture to sciences. A great part of my artistic experience took place in hackerspaces in Brazil, surrounded by the Free/Libre Open Source Software (FLOSS) ideology, the open free/libre culture of sharing. Nowadays, for several ideological and practical reasons that do not fall within the scope of this article, the most common term is “open source”. And lucky for me, my career switch started with an internship in an Open Source Program Office (OSPO), which made this switch feel — almost — like home.
### Standing on the shoulders of giants
We all benefit from open source. Whether you code or not, the software you use relies on it. Since it is an open culture where everything is built upon the work of others, its common to hear the term “standing on the shoulders of giants”, which refers to the idea that advancements are built upon the work and contributions of those who came before us. This highlights the importance of learning from the experiences and accomplishments of others.
This article is meant to unveil whose shoulders I am standing on. And this is not only to show my gratitude to them but also to answer a question I was asked while being interviewed by Kevin Ball and Christopher Hiller at JSParty: What can you do to improve diversity in your surroundings?
“Standing on the shoulder of giants” regards not only to open source but its the base of sisterhood in technology by recognizing female pioneers and leaders roles in the field. By acknowledging the contributions of women who came before us, we can gain inspiration and insight into the challenges they faced and learn from their experiences in overcoming some shackles. In this way, we “stand on the shoulders of giants” and build upon their work to create a more inclusive and supportive environment for women and _underestimated_ [2] people in technology.
By supporting one another, recognizing the importance of learning from the experiences of others, and forming a supportive network, we can work together to overcome challenges and build a better future for all by creating a more equitable environment. By doing so, we are creating new giants for others to stand upon in the future.
### Organizing a local community: Meili Triantafyllidi and Jessica Greene
I joined PyLadies Berlin, which was founded by Meili in 2013. Jessica, one of the organizers, was a junior software engineer at Ecosia. Being a community organizer means using your free time to passionately do all the work needed to create a safe, supportive networking and learning space. It includes finding a hosting place, promoting the event, curating themes, finding speakers, and most importantly, listening to the needs of the community.
Being new in a multicultural city and trying to find my place in it, PyLadies was less a place to learn Python and more a center to be welcomed and understood.
According to the narrative we are told, tech is the new promise land everyone is heading to, with infinite job postings, freedom to switch countries, and a well-paid careers. This isnt being offered in other sectors, or at least not at this scale. And communities focused on bringing diversity to the space offer to make this a realistic possibility for everyone.
Every event starts with community announcements, a simple slide containing an agenda, and promotions for similar events. Two of the events I heard guided me to my career path: the Rail Girls Summer of Code program and the FrauenLoop. Feeling compelled to contribute back to the supportive community Id already received, I became one of the co-organizers.
### Networking and learning: FrauenLoop
Founded by Dr. Nakeema Stefflbauer in 2016, FrauenLoop has committed to changing the face of EU-based tech companies. The program is divided in 3 months cycles, which are composed of weekly evening classes and weekend workshops to train women who dont have a tech industry connection.
The learning curriculum is developed around the professional needs of women, from technical industry-focused classes to workshops delivered by women on how the tech industry really works and how to successfully navigate it. Some common topics are salary negotiation and practicing technical interviews. Most recently, in response to the layoffs, there was a workshop run with the Berlin Tech Workers Coalition about Demystifying the Termination Challenge Process.
The focus is on women, especially migrants, the ones changing family status and careers who are really ready to go job searching.
Being around Nakeema is itself an inspiration. The program was a starting point for understanding what coding means and learning the basics of web development. But the greatest part was connecting with others who would later become PyLadies co-organizers, speakers, mentors in side projects, and friends.
FrauenLoop also gives its students the opportunity to go back as mentors. For me, this was the breaking point that definitively set my path. I have been a mentor for over a year, and it has improved my confidence in myself and reinforced my own learning. Being challenged by the responsibility to facilitate the learning to others, you inevitably have to learn.
There I met Victoria Hodder, who was my partner applying to Rail Girls Summer of Code.
### Diversity programs: from Rail Girls Summer of Code to Ecosia Summer of Code
Rail Girls Summer of Code was a global fellowship program for women and non-binary coders where successful applicants received a three-month scholarship to work on existing open source projects. The program was active from 2013 to 2020.
The application was submitted by a team, meaning two people from the same city. While it was a remote program, having a local peer ensured accountability and support.
It also required a place to work, an environment suitable for working for three months. This place could be your home, a co-working space, a work office, or in the best-case scenario, a coaching company. Although the coaching company had no obligation beyond offering a space to work, it connected us with a local company and gave us a space to have visibility and network with people within the industry we wanted to enter.
Jessica, my PyLadies Berlin co-organizer, had kick-started her career in tech with the program. She proposed Ecosia, her then and current company, to be the coaching company for two teams. One team was myself and Victoria (we focused on web development) and the other was Taciana Cruz and Karina Cordeiro (they focused on data).
During the three month application period, the COVID-19 pandemic hit hard. Victoria and I had been _sort of_ selected for the Rail Girls Program after getting involved with the [if-me][2] project. _Sort of selected._ Communication with Rail Girls got really messy by the end of the selection period until they finally canceled the program at the last minute.
We were all devastated. The weight of the pandemic hit us hard, crushing not only a chance for a paid job but a dream of starting a new career that had been cultivated for so long.
Jessica, a junior software developer at the time, knew that. So she took a step further and, instead of feeling powerless, she took a stand. She piled more work on top of her personal struggles navigating her new role and created the [Ecosia Summer of Code][3].
Ecosia couldnt cover scholarships, but Jessica developed a mentorship instead. The program used the companys available resources, offering mentorship from highly qualified professionals to fill gaps in our knowledge. As Victoria and Karina dropped the initiative, needing paid jobs, Taciana and I managed to continue on individual projects. We found common themes to work on and supported each other.
About a year later, I was invited by one of those mentors, Jakiub Fialla, to talk about open source to the company. I am still connected with a few others, and every now and then, I stop by and meet some of them when they host PyLadies Berlin events. How sweet is that?
### Sponsoring diversity: Coyotiv and Armagan Amcalar
When Rail Girls was canceled, I saw an Instagram post about a bootcamp offering a full stack web development program scholarship.
The application was fairly simple, so I applied. I quickly received a spontaneous invite for an interview. Depressed, messy, and hopeless, I attended without any preparation, so I was brutally honest. The conversation was equally honest, which I highly appreciated.
The interviewer was Armagan Amcalar, the founder of the [Coyotiv School Of Software Engineering][4]. Coming from a music background, Armagan is creative and thinks critically about the world around him. The school itself started after he offered free crash courses in Women Techmakers Berlin for three years. He doesnt use a rote diversity speech, he acts upon it, offering scholarships to all full-time participants.
I got the scholarship, and together with four other people (3 of them women), the first cohort was formed. Bootcamp lasted for 17 super intense weeks. This was fundamental in changing my perspective on code. Unlike other places I had tried to learn, the least of Armagans concerns is about the framework we choose. Instead, it was all about understanding what we were doing, and thinking about software engineering as a creative, powerful tool shaping the world we live in. I didnt get just a scholarship, I got a friend and a mentor for life who offered me a turn and opened a door for a better life.
Do you think I am overreacting? Talk to people around me. My partner, who has known me for about 14 years at this point, commented on how much I had changed. Disciplined, vibrating, happy about the things I was learning along the way, having deep conversations about software and its surroundings, not being conflicted, letting go a life-long career in arts, and finding a purpose. It was so remarkable that he joined a few cohorts after me.
The school provided me with technical knowledge, interview training, CV support, and public speaking training. Graduation was not only about developing a personal full-stack project. You also had to give back to open source, in recognition that so much software is built upon it, by publishing a library on npm. Node Package Manager (npm), is a Javascript package repository that allows you to reuse code by easily installing it within your Javascript-based projects. Although I have been involved with the free software movement and open source for over a decade, Id never thought I could give back to it with actual code.
### My contribution
This is how [rainbow-penguin][5] was born. Its an npm library that sends motivational messages to developers while coding. Maybe its not a very functional tool. Still, to me, it was a needed tool based on my personal experience wading through the frustrations of learning to code, contributing to the if-me project, and hearing so many similar stories from other learners.
Through my experiences in these programming communities, I learned that code is much bigger than the lines of code, and how powerful and necessary it is to have allies. No matter who you are or what you think you know, there are opportunities within the free and open source software communities. Your participation doesn't have to be big, because together our contributions are greater than their sum. Take the first step. Find your allies within open source.
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/power-sisterhood-allyship-open-source
作者:[Paloma Oliveira][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/discombobulateme
[b]: https://github.com/lkxed/
[1]: https://enterprisersproject.com/article/2022/9/software-developer-day-life?intcmp=7013a000002qLH8AAM
[2]: https://www.if-me.org/
[3]: https://blog.ecosia.org/ecosia-summer-of-code-mentoring/
[4]: https://www.coyotiv.com/
[5]: https://www.npmjs.com/package/rainbow-penguin

View File

@ -0,0 +1,73 @@
[#]: subject: "How I returned to open source after facing grief"
[#]: via: "https://opensource.com/article/23/3/open-source-after-grief"
[#]: author: "Amita Sharma https://opensource.com/users/amita"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How I returned to open source after facing grief
======
The open source community is a wonderful place where people come together to collaborate, share knowledge, and build amazing things. I still remember [my first contribution in Fedora][1] 12 years ago, and since then its been an amazing journey. However, life can sometimes get in the way and cause us to take a break from participation. The COVID-19 pandemic has affected us all in different ways, and for some, it has been a time of immense loss and grief. I lost my loved one during the pandemic, and it has been the most difficult life event to deal with. It caused me to take a break from the Fedora community, as well. For those in the open source community who have had to take a break due to the loss of a loved one, returning to coding and contributing to projects can feel daunting. However, with some thought and planning, it is possible to make a comeback and once again become an active member of the community.
First and foremost, it is important to take care of yourself and allow yourself the time and space to grieve. Grief is a personal and unique experience. There is no right or wrong way to go through it. It is important to be kind to yourself. Dont rush into things before you are ready.
Once youre ready to start contributing again, there are a few things you can do to make your comeback as smooth as possible.
### Reach out to other contributors
This is a hard truth: nothing stops for you and technology is growing exponentially. When I rejoined Fedora recently, I felt the world had changed around me so fast. From IRC to Telegram to Signal and Matrix, from IRC meetings to Google Meet, from Pagure to GitLab, from mailing lists to discussion forums, and the list goes on. If you havent been active in your community for a while, it can be helpful to reach out to your friends in the community and let them know that youre back and ready to contribute again. This can help you reconnect with people and get back into the swing of things. They may have some suggestions or opportunities for you to get involved in. I am grateful to my Fedora friend [Justin W. Flory][2], who helped me out selflessly to ensure I found my way back into the community.
### Start small
In the past, I served as [Fedora Diversity, Equity, & Inclusion (D.E.I.) Advisor][3], which is one of the [Fedora Council][4] member positions. It was a big job. I recognized that, and I knew that were I to think of doing the same job immediately after my break, then it would have been a burden that could threaten to cause [early burnout][5]. Its vitally important to take it easy. Start small.
If youre feeling overwhelmed by the thought of diving back into a big project, start small. There are plenty of small tasks and bugs that need to be fixed, and tackling one of these can help you ease back into the community.
### Find a mentor
If youre feeling unsure about how to get started or where to focus your efforts, consider finding a [mentor][6]. A mentor (in my case, Justin W. Flory) can provide guidance, advice, and support as you make your comeback.
### Show gratitude
An open source community is built on the contributions of many people. A healthy community is grateful for your contribution. Showing gratitude is part of making a community healthy. Show your gratitude to others who help you, guide you, and give you feedback.
### Block your calendar
Initially, it may take some time to get back to the rhythm of contributing. It helps to schedule some time in your calendar for open source work. It can be weekly/bi-weekly, depending on your availability. Remember, [every contribution counts][7], and that is the beauty of the open source world. This trick will help you to get into a regular routine.
### Two steps forward, one step back
Finally, its important to remember that its okay to take a step back if you need it. Grief is not a linear process. You may find that you need to take a break again in the future. Its important to be honest with yourself and others about your needs. Take the time you need to take care of yourself.
### Return on your own terms
Returning to the open source community after a period of grief can be challenging. Its also an opportunity to reconnect with something you are passionate about and make a positive impact in the world. In time, youll find that youre able to pick up where you left off, and re-engage with the community once again.
I dedicate this, my first ever Opensource.com article, to my late younger brother Mr. Nalin Sharma, who left us at the age of 32 due to COVID-19 in 2021. He was a passionate engineer and full of life. I hope he is in a better place now, and I am sure he will always be alive in my memories.
![Amita and Nalin Sharma][8]
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/open-source-after-grief
作者:[Amita Sharma][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/amita
[b]: https://github.com/lkxed/
[1]: https://fedoraproject.org/wiki/User:Amsharma
[2]: https://opensource.com/users/jflory
[3]: https://docs.fedoraproject.org/en-US/diversity-inclusion/roles/council-advisor/
[4]: https://docs.fedoraproject.org/en-US/council/
[5]: https://opensource.com/article/21/5/open-source-burnout
[6]: https://enterprisersproject.com/article/2019/10/it-mentors-how-make-most-of-mentoring?intcmp=7013a000002qLH8AAM
[7]: https://opensource.com/article/23/3/non-code-contribution-open-source
[8]: https://opensource.com/sites/default/files/2023-02/nalin-sharma.webp

View File

@ -0,0 +1,70 @@
[#]: subject: "My first pull request at age 14"
[#]: via: "https://opensource.com/article/23/3/my-first-code-contribution-age-14"
[#]: author: "Neil Naveen https://opensource.com/users/neilnaveen"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
My first pull request at age 14
======
My name is Neil Naveen, and I'm a 14-year-old middle schooler who's been coding for seven years. I have also been coding in [Golang][1] for two years.
Coding isn't my only passion, though. I've been practicing Jiu-Jitsu for four years and have competed in multiple competitions. I'm passionate about coding and Jiu-Jitsu, as they teach me important life lessons.
### Codecombat
I started coding on [Codecombat][2], which taught me many fundamental coding skills.
One of the most exciting moments in my coding journey was when I ranked 16th out of around 50,000 players in a multiplayer arena hosted by Code Combat. I was just 11 years old then, and it was an incredible achievement for me. It gave me the confidence to continue exploring and learning new things.
### Leetcode
After Codecombat, I moved on to [leetcode.com][3]. This site helped me hone my algorithm coding skills with tailored problems to learn specific algorithms.
### Coding Game
When I turned 13, I moved on to bot programming on [Coding Game][4]. The competition was much more intense, so I had to use better algorithms. For example, when creating ultimate tic-tac-toe AI, I used algorithms like Minimax and Monte Carlo Tree Search to make my code fast and efficient.
### GitHub CLI
One day, I saw my dad using an open source tool called [GitHub CLI][5], and I was fascinated by it. GitHub CLI is a tool that allows users to interact with the GitHub API directly from the command line without ever having to go to GitHub itself.
Another day, my dad was reviewing PRs from a bot designed to detect vulnerabilities in dependencies.
Later, I thought about GitHub CLI and this bot, and wondered whether GitHub CLI itself was being monitored by a security bot. It turned out that it was not.
So I created a fix and included a security audit for GitHub CLI.
To my delight, my contribution was accepted. It was merged into the project, which was a thrilling moment for me. It was an excellent opportunity to contribute to a significant project like a popular tool like GitHub CLI, and to help secure it. Here's the link to my PR: [https://github.com/cli/cli/pull/4473][6]
### Commit your code
I hope my story will inspire other young people to explore and contribute to the open source world. Age isn't a barrier to entry. Everyone should explore and contribute. If you want to check out my website, head over to [neilnaveen.dev][7]. You can also check out my [Leetcode profile][8]. And if you're interested, check out my talk at [CloudNativeSecurityCon][9] recording.
I'm grateful for the opportunities I've had so far, and I'm excited to see what the future holds for me. Thank you for reading my story!
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/my-first-code-contribution-age-14
作者:[Neil Naveen][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/neilnaveen
[b]: https://github.com/lkxed/
[1]: https://opensource.com/article/18/11/learning-golang
[2]: https://codecombat.com
[3]: https://leetcode.com/neilnaveen
[4]: https://www.codingame.com/profile/0fa733a2c7f92a829e4190625b5b9a485718854
[5]: https://github.com/cli/cli
[6]: https://github.com/cli/cli/pull/4473
[7]: https://neilnaveen.dev
[8]: https://leetcode.com/neilnaveen/
[9]: https://www.youtube.com/watch?v=K6NRUGol-rE

View File

@ -0,0 +1,101 @@
[#]: subject: "How being open at work results in happy customers"
[#]: via: "https://opensource.com/article/23/3/open-customer-support"
[#]: author: "Kat Gaines https://opensource.com/users/katgaines"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How being open at work results in happy customers
======
Every interaction we have with another person is influenced by our emotions. Those emotions have ripple effects, especially when it comes to how you do business. A happy customer patronizes your business more, recommends it to family and friends, writes a positive review, and ultimately leads to more money being spent at your business than if they'd been disappointed. The most basic known variable of providing good customer service influences this: If something isn't going as expected, work to make it right (within reason), and you'll save the relationship.
In tech, you can respect this in a few ways. If you listen to customer feedback, create products they'll find useful and intuitive, and nurture those positive associations with your project, then you'll do well. But there's an oft overlooked component to your customer's emotional perception of your business, and that's the customer support team.
### Customer support team
The interactions handled by a support team carry a high emotional charge for the customer. Software needs to work, and it needs to work **now**.
Software faces a unique challenge when it comes to how a customer-facing team builds a relationship: it's primarily a virtual interaction. For in-person customer care, an employee wields the superpower of eye contact, a strong emotional influence. Facial expressions force us to interact with more empathy than say, a voice over the phone, or an email response.
When that's not possible, though, the ability to shift the emotional tone to a calm one can be challenging. It's easy for a customer to have a natural bias toward online support. Maybe they've had a bad experience with heavily automated support in the past. There are plenty of badly configured chatbots, unnavigable phone menus, and dispassionate robotic voices to add fuel to the fire when emotions are already high. A customer may have talked to a support agent who's [miserable at work][1] and therefore apathetic to the outcome. The customer carries these experiences into their emotional approach when asking for help. This can create stress for the agent who picks up their ticket, and a vicious cycle repeats.
Because of high stakes, emotional nature of Customer Support (CS), your business has an opportunity. Corral these big emotions through the people who have the most access to them. The key to doing this successfully is to remember the ripple effect. A customer service agent with the necessary tools and knowledge at their fingertips is happy. A happy customer service agent has better conversations with customers. You can set yourself apart from competitors by creating happy customer support agents in an empowered and knowledgeable customer service team. How is this done?
### Preparing for success
If youre a leader in customer support, or a stakeholder elsewhere in the organization (engineering, product, and so on) who works with support a lot, you can work in key areas to make the lives of your support agents a little easier:
#### Create visibility
As a customer support agent, you need data about the customer you're helping. You need to know the systems your customer is using, and the products you're meant to support. It's crucial to have visibility into other teams in the organization, because they have that kind of data. You need to know who to ask for help when a problem arises, what the known issues are, what's being worked on already, and so on.
Siloed departments are a common major barrier to achieving visibility across teams. This can be made worse by tools and systems that don't connect departments, such as a spreadsheet directory or filing issues in an internal tracking tool. When this is the case, the customer service department can't get timely information on the status of an issue, and the engineering department can't get a good feel for how customers are experiencing the issue.
If your customer service team is given visibility into the complexity faced by your engineering teams, it's easier to clearly articulate the state of issues to customers and stakeholders. Customer service teams can create visibility for engineering, too. Crucial information about problems can come from your customers. When engineering has visibility into customer issues, they're better equipped to prioritize for customer needs.
Everyone works hard to prevent customers from being affected by issues, but that's not always realistic. Use the data your customers give your customer service team about what's wrong, and empower your customer service agents to become part of an incident response process rather than just reacting to it.
#### Make difficult moments easy
Customer support is a difficult job. If you have never worked in customer service, I'm giving you some homework: shadow your customer support team so you can understand where friction happens. It's a great way to get to know who your customers really are, by seeing them in their highest emotional moments, and seeing how your team navigates that. Customer service means all the questions coming your way, few of the answers at your fingertips, manual tasks to complete, and not enough people to share the load.
Make the job easy for customer service where you can. It will pay off. Maybe you can help the team automate mundane tasks to better focus on more interesting problems. Often this manifests in chatbots, but it's worth being creative here. For example, can automation be applied when escalating tickets to engineering? That could free an agent to work on their troubleshooting process, rather than the manual steps of making that escalation happen.
You can use tooling your engineering team might already have in place to find these opportunities. Operations platforms can be shared to put both team's metrics out in the open, helping everyone stay aligned on common goals.
The feedback loop required for a mature software development life cycle needs the customer service team to operate effectively. You can only do that with shared visibility across your organization.
Making it easy also means proactive design, especially when it comes to processes for critical moments. You probably have a process to manage major incidents. When you share these tools and processes with customer service, you enable greater visibility and gain valuable insight and teammates along the way. During an incident, customer service can play a few key roles:
##### Aggregating customer reported issues
When an incident triggers, engineering needs to quickly find out how much of the service is impacted, including how many features, the depth to which they are affected, and whether they are slow or completely offline. Customer impact is part of that, which customer service can help uncover by associating inbound customer complaints to technical incidents to help drive priorities. As customer service receives reports of issues during an incident, that data becomes part of the impact of the incident, and is incorporated into the resolution process.
##### Prioritization of SLA
Your customer service team is in a unique position to help confirm the impact of an incident on the end user. They have insight into when services are reaching their [Service Level Agreement (SLA)][2] for certain customers, and can alert the responding team. This is an important piece of information to manage, and engineering teams might not have visibility into those contractual agreements. This aids in the prioritization of issues during incidents. CS can advise on whether or not an incident should be escalated or have its severity increased based on the customer intelligence they are receiving. More customer impact could mean a higher severity level for the incident, more responders included in the triage, and more stakeholders informed.
##### Liaisons and stakeholder communication
Speaking of stakeholders, customer service can take the lead when it comes to codifying communication practices for incidents. Customer service can take ownership of policies around messaging for customers, template responses, and communication processes. Templates with clear information and status pages to keep up to date are just some of the assets they can manage.
##### Post-incident follow-up
You'll always encounter customers who watch your status page like a hawk for updates. These customers and others ask customer service for updates if they don't see progress. You can ease the cognitive load of responding to these customers with the newfound connection with the incident process. If you hold incident reviews, then customer service must be part of that conversation. The tone of a conversation changes when a customer service agent has extra data to present to users about the impact of the incident, the resolution, and long-term plans for prevention. Your customer feels consistency, and your agent feels real ownership of the conversation.
At the end of the day, involving your customer service team through the entire process, from start to finish, allows them to gain control of their own destiny. It lets them provide valuable input back into the resolution process, and leverage their improved experience to improve the [customer experience][3].
### Invest in people
You can't create a happy employee out of thin air. Customer service leaders need help doing this. People need investment in career growth, the ability to collaborate with their peers, and a voice in the organization to know that their feedback is heard.
Your customer support team is not here to report on metrics to the business or to slog through the queue. Investing means giving them time and space to expand their skills and grow in their careers. For customer service leaders, this comes with knowing you may not keep them in support forever. You can build a strong team that offers phenomenal support, and also creates a hiring funnel into the rest of the business.
The first level of this is up-leveling agents within support. It's common to have a "premium" support team, or similar, for customers who need a high touch level of support, and the ability to get help at any hour. Hiring 24x7 staff won't help a customer service leader redesign their team's status as a cost center, but developing a staffing model to use the existing team's time efficiently can. Sharing tooling with engineering can be one way to get there. For example, if engineering is on call for responding to issues, customer service can use the same tooling to provide a creative solution, rotating a specialized team for those odd hours or high priority issues.
This can open up a new career path for those who want to be on a team with specialized knowledge. Having a team that can be notified as-needed, rather than fully staffed at all times, staring at a queue, and waiting for incoming requests, allows leaders to scale their customer experience efficiently.
Empowering customer service teams to reach out to other teams and advocate for customers also creates new communications channels and opportunities. Your customer service team can serve as a gateway into your organization for technical personnel who are still building skills. A close relationship with engineering supports career growth. Shared processes promote this. So does a shadowing program, having a subject matter expert in support departments for different product areas, and intentionally building career paths to assist transitions when it's time to do so. Customer service agents who transition to other departments bring with them their customer focus and dedication to the customer experience. This is a valuable addition to teams in your organization which increases [empathy][4] across the board.
The modern software development life cycle doesn't end when code is checked into a repository and all the tests turn green. A constant feedback loop from users back into development planning links user requirements directly to the product management phase of the cycle. Organizations across various industries have seen the benefits of adopting shared goals and purposes across different teams. Include your customer service team in larger organization-wide initiatives, like DevOps transformations and automation projects. Doing this increases the effectiveness of customer-focused teams, and improving their day-to-day work in turn improves the experience they can provide for customers. In a nutshell: Happy agents translate to happy customers.
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/open-customer-support
作者:[Kat Gaines][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/katgaines
[b]: https://github.com/lkxed/
[1]: https://opensource.com/article/23/1/community-leadership-introducer-chief
[2]: https://opensource.com/article/23/2/sle-sla-open-source-projects
[3]: https://enterprisersproject.com/article/2023/2/transform-customer-service-enterprise-it?intcmp=7013a000002qLH8AAM
[4]: https://enterprisersproject.com/article/2020/7/customer-experience-how-develop-empathy?intcmp=7013a000002qLH8AAM

View File

@ -0,0 +1,81 @@
[#]: subject: "Why your open source project needs a content strategy"
[#]: via: "https://opensource.com/article/23/3/open-source-project-content-strategy"
[#]: author: "Emily O'Neill https://opensource.com/users/emilyo"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Why your open source project needs a content strategy
======
If you search for content strategy in your favorite search engine, I bet that you find that it is a term more strongly associated with marketing content than with technical content. However, a technical content strategy is a powerful way to align stakeholders around content goals for your open source project. In this article, I explore the benefits of technical content strategy and how having one can improve the user and contributor experience of your community projects.
When developing a content strategy, you should consider your goals. The goals differ depending on the user. For the marketing team, the goal of content strategy is to attract and connect with existing and potential customers by using content. Marketing content strategists aim to engage customers and develop relationships with the brand.
The goal of technical content strategists is to guide users with technical content that helps them achieve their goals. It should provide them with just enough information to successfully complete their task.
### Creating a content strategy
So how do you create a content strategy that helps you achieve your goal? You can do this by having someone on your project take the role of content strategist. Their task is to document what user content is created, where it is published, how users can find it, and how it can be maintained, published, and retired. The content strategy should be available where contributors can find it easily.
### Content types and publication locations
The first step to creating content is to get to know the project's audience. Identifying users is best done with all project stakeholders contributing, so there is a shared understanding of who the users are and what their goals are. A tip for open source content strategies is to consider your contributor personas as well as your end-user consumer personas.
A good content strategy is grounded in meeting the user's needs. The project's content should not tell users everything the content creator knows about something. The content should tell the user just enough to complete a task. When the personas are identified and documented, the strategist considers what types of content help these personas be successful. For example, can the user needs be met completely with microcopy in the user interface, or do they need more detailed documentation? Is the contributor onboarding workflow best demonstrated in a video or a blog with screenshots?
While considering what content types to create, the strategist also looks at where the content should be published so your personas can easily find it. The strategist needs to consider how content creators should progressively disclose information if it is not possible to keep the user in their context. For example, if the user is struggling to understand a log file, you can link them to more information on the project's documentation website.
The strategy should give guidance to help decisions about what types of content might best solve the user's problem. The content creator should be challenged to ask themselves what content type best meets the user's needs in the moment. Do they need a new documentation article on the website? Could the user friction point be avoided with a clear error or log message, a better UI label, or other content type? You should make clear that sometimes the answer to a problem isn't always to create more content.
### Content reviews and retirement
Now that you have a strategy for what types of content you want and where to publish them, you need to consider governance. The first part of this process is to decide what types of reviews your content requires before publishing. For example, does it require a content plan review, subject matter expert review, editorial review, peer author reviews, or copy reviews. You should also decide how reviews and approvals are tracked.
The second aspect of governance is to decide on a schedule for retirement or archival of content. The strategist should document how content is reviewed for retirement in the future. You should decide if content needs to be retired annually or before every new version release. You should also consider if the content needs to be accessible in some format for users using older versions.
If you are creating a content strategy for an existing project, the chances are high that your project already has some content. As part of the creation process, the content strategist should audit this content, and consider if it is still current and useful. If it is out of date, it should be retired or archived.
### A content strategy is beneficial for everyone
Now that you have a content strategy for your project, you should see how it benefits your users, contributors, and your project as a whole.
#### Project end users
At the heart of the content strategy is the audience. The strategy is centered on the personas interacting with the project. It considers how you can provide them with easily findable information in a consumable format that helps them complete their goals. End users benefit from a content experience that is built around their needs. It should also be self-service so they can solve problems independently.
#### Contributors
Content consumers, just like end users, benefit from self-service content. New contributors to the project benefit from content designed to onboard them to the project quickly and with ease. The experienced contributor persona gets content that helps them learn about new features of the project. They can also get help with more technically challenging areas. Contributor personas benefit from having accessible reference information. This information can describe the interfaces and features that are available to them to use, build on, and use to interact with the product or service.
The contributors to your project are also the people creating the content that your users consume. Content strategy can help them to understand and feel empathy for user personas, their goals, and use cases. Giving contributors a common understanding of the user's content needs and the types of content that satisfies them supports the creation of a consistent content experience.
Creating a strategy helps all content creators easily understand and align with the content vision. It keeps them focused on creating high-value content that reduces user friction.
#### Project
In an ideal world, your project would have all the resources needed to create the ideal content experience for your users as envisioned in your strategy. Unfortunately, we live in the real world with conflicting priorities and resource-constrained projects. The good news is that a user-centered content strategy gives the team a shared vision of the content experience. This strategy helps build a content foundation that the project can iterate with each release. It also helps the team make more informed decisions about content.
Your project also benefits from accessible documentation that better serves your users. Your content experience helps users recognize and realize the value of what you have created.
### Implement a content strategy
Your content strategy should be a living artifact, guiding content decisions for the project. With this in mind, it should be revisited frequently and tweaked to reflect what is working or not working for your users. Keeping it current enhances your content experience and improves its effectiveness in guiding your users to success.
I believe that the practice of content strategy should be more widely adopted in the technical world as it is a powerful tool. It can help you create a better experience for all of your users. The experience should consider each user's needs, workflow, pain points, and emotions. This helps projects deliver the right content in the right place at the right time.
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/open-source-project-content-strategy
作者:[Emily O'Neill][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/emilyo
[b]: https://github.com/lkxed/

View File

@ -0,0 +1,63 @@
[#]: subject: "The open source way of raising a family"
[#]: via: "https://opensource.com/article/23/3/open-source-family"
[#]: author: "Ruth Netser https://opensource.com/users/rnetser1"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
The open source way of raising a family
======
As a rebellious teenager in the 80s, "because I said so" was a phrase I heard all too often at home. I wasn't really a rebel. I just wanted to be heard and seen as a person starting to articulate their thoughts and emotions.
The feeling I had of not being heard or listened to led me to believe that it's important to raise kids who are not afraid to speak up, but who can also learn to adapt. Listening to them and collaborating with kids can also help them be creative and, eventually, allow them to be part of a successful organization.
### How children interpret information
I didn't intentionally encourage open behaviors for my children, nor did I actively tell my kids to speak up. Nevertheless, on my eldest son's first day of kindergarten, we were called by his teacher. She told us that when she went over the rules of not fighting, pushing, and so on with the class, my kid had raised his hand to tell her that his parents allowed him to dispute and debate all the time.
It was true. I let my boys express themselves and be heard. But my kid's words surprised me. Only then did I realize that while I'd been doing something right, the fact is that how my kids act shouldn't just be a reaction to the way we educate them. Nor should we leave it up to them to pick things from second-hand context. That day was a game changer for me, and practicing an open culture officially and proactively entered our home.
### Open for growth
When I was young, parents and elders were the knowledgeable ones.
As a kid, it was not always easy to get information. While I was encouraged to express an opinion, it was only up to the point where it was a normative and "easy to digest" one. Today, parents and teachers and kids all have the same means to access data. What you do with it is entirely up to you.
For example, when playing Scattergories in Hebrew, the word "virus" is normally the only animal starting with "V" that most people play. To gain more points, we decided to find additional animal names that qualified. In no time, we found not one but three new animals (my kid's teacher argued that a "wallaby" (spelled with a "V" in Hebrew) was not a real thing, but that's another story).
I teach my kids to read between the lines and never to accept things presented to them as "facts" without question. This allows them to practice critical thinking. It also allows them to question me, which leads us to open and transparent discussions.
Are these discussions easy? No. Do I always have the energy to conduct them? Absolutely not.
However, to help them practice the learn-to-listen "muscle," these conversations are a must.
Occasionally, we have to force ourselves to find time to focus our attention on our family. It takes time to build a robust and open culture, and as people change so does your family culture. You have to adapt and work to keep it alive. As leader of the pack, I have to provide my kids with a safe place, a place where they can openly share their ideas, a place where they feel belonging.
In a family, you have to collaborate and solve problems together. Listening to the different ideas and approaches to solving issues allows you to come up with creative (and yet not always to everyone's liking) solutions.
One issue in my home was the noise in the house when playing computer games. This happens mostly late at night and on the weekends. We sat down together and came up with an agreed-upon timeslot for noisy games. From then on, those who wanted to play knew when they could play, and those seeking some quiet time also knew when those times would happen. As kids grow up, the nature of the decisions and discussions change.
Does it mean that all decisions are shared with the kids? No. Does it mean that it's all roses? Absolutely not.
Encouraging kids to connect may end up with a broken vase for which no one seems to be accountable. It may lead to "because I said so" to pop in for a visit. However, having challenging yet inclusive conversations, encouraging innovative thinking, and including kids in decisions are ways of preparing them for adulthood. Hopefully, it'll make them better people, too (so far, this is working well, in my humble opinion.)
### Open family culture
Practicing open culture is not a one-time thing. It's a journey, and it's a mindset. I believe it provides both my kids and me the tools to be resilient, open-minded, tolerant, and inquisitive both inside the house and out. Start an open culture with those closest to you, and take it with you everywhere you go.
--------------------------------------------------------------------------------
via: https://opensource.com/article/23/3/open-source-family
作者:[Ruth Netser][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/rnetser1
[b]: https://github.com/lkxed/

View File

@ -1,89 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (cool-summer-021)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Open Source Security Foundation (OpenSSF): Reflection and Future)
[#]: via: (https://www.linux.com/news/open-source-security-foundation-openssf-reflection-and-future/)
[#]: author: (The Linux Foundation https://www.linuxfoundation.org/en/blog/openssf-reflection-and-future/)
Open Source Security Foundation (OpenSSF): Reflection and Future
======
The [Open Source Software Foundation (OpenSSF)][1] officially [launched on August 3, 2020][2]. In this article, well look at why the OpenSSF was formed, what its accomplished in its first six months, and its plans for the future.
The world depends on open source software (OSS), so OSS security is vital. Various efforts have been created to help improve OSS security. These efforts include the Core Infrastructure Initiative (CII) in the Linux Foundation, the Open Source Security Coalition (OSSC) founded by the GitHub Security Lab, and the Joint Open Source Software Initiative (JOSSI) founded by Google and others.
It became apparent that progress would be easier if these efforts merged into a single effort. The OpenSSF was created in 2020 as a merging of these three groups into “a cross-industry collaboration that brings together leaders to improve the security of open source software (OSS).”
The OpenSSF has certainly gained that “cross-industry collaboration”; its dozens of members include (alphabetically) Canonical, GitHub, Google, IBM, Intel, Microsoft, and Red Hat. Its governing board also includes a Security Community Individual Representative to represent those not represented in other ways specifically. Its also created some structures to help people work together: its established active working groups, identified (and posted) its values, and agreed on its technical vision.
But none of that matters unless they actually _produce_ results. Its still early, but they already have several accomplishments. They have released:
* [Secure Software Development Fundamentals courses][3]. This set of 3 freely-available courses on the edX platform is for software developers to learn to develop secure software. It focuses on practical steps that any software developer can easily take, not theory or actions requiring unlimited resources.  Developers can also pay a fee to take tests to attempt to earn certificates to prove they understand the material.
* [Security Scorecards][4]. This auto-generates a “security score” for open source projects to help users as they decide the trust, risk, and security posture for their use case.
* [Criticality Score][5]. This project auto-generates a criticality score for open source projects based on a number of parameters. The goal is to better understand the most critical open source projects the world depends on.
* [Security metrics dashboard][6]. This early-release work provides a dashboard of security and sustainment information about OSS projects by combining the Security ScoreCards, CII Best Practices, and other data sources.
* [OpenSSF CVE Benchmark][7]. This benchmark consists of vulnerable code and metadata for over 200 historical JavaScript/TypeScript vulnerabilities (CVEs). This will help security teams evaluate different security tools on the market by enabling teams to determine false positive and false negative rates with real codebases instead of synthetic test code.
* [OWASP Security Knowledge Framework (SKF)][8]. In collaboration with OWASP, this work is a knowledge base that includes projects with checklists and best practice code examples in multiple programming languages. It includes training materials for developers on how to write secure code in specific languages and security labs for hands-on work.
* [Report on the 2020 FOSS Contributor Survey][9], The OpenSSF and the Laboratory for Innovation Science at Harvard (LISH) released a report that details the findings of a contributor survey to study and identify ways to improve OSS security and sustainability. There were nearly 1,200 respondents.
The existing [CII Best Practices badge][10] project has also been folded into the OpenSSF and continues to be improved. The project now has more Chinese translators, a new ongoing Swahili translation, and various small refinements that clarify the badging requirements.
The [November 2020 OpenSSF Town Hall][11] discussed the OpenSSFs ongoing work. The OpenSSF currently has the following working groups:
* Vulnerability Disclosures
* Security Tooling
* Security Best Practices
* Identifying Security Threats to Open Source Projects (focusing on a metrics dashboard)
* Securing Critical Projects
* Digital Identity Attestation
Future potential work, other than continuously improving work already released, includes:
* Identifying overlapping and related security requirements in various specifications to reduce duplicate effort. This is to be developed in collaboration with OWASP as lead and is termed the [Common Requirements Enumeration (CRE)][12]. The CRE is to “link sections of standard[s] and guidelines to each other, using a mutual topic identifier, enabling standard and scheme makers to work efficiently, enabling standard users to find the information they need, and attaining a shared understanding in the industry of what cyber security is.” [Source: “Common Requirements Enumeration”]
* Establishing a website for no-install access to a security metrics OSS dashboard. Again, this will provide a single view of data from multiple data sources, including the Security Scorecards and CII Best Practices.
* Developing improved identification of critical OSS projects. Harvard and the LF have previously worked to identify critical OSS projects. In the coming year, they will refine their approaches and add new data sources to identify critical OSS projects better.
* Funding specific critical OSS projects to improve their security. The expectation is that this will focus on critical OSS projects that are not otherwise being adequately funded and will work to improve their overall sustainability.
* Identifying and implementing improved, simplified techniques for digitally signing commits and verifying those identity attestations.
As with all Linux Foundation projects, the work by the OpenSSF is decided by its participants. If you are interested in the security of the OSS we all depend on, check out the OpenSSF and participate in some way. The best way to get involved is to attend the working group meetings — they are usually every other week and very casual. By working together we can make a difference. For more information, see [https://openssf.org][1]
_[**David A. Wheeler,**][13]_* Director of Open Source Supply Chain Security at the Linux Foundation***
The post [Open Source Security Foundation (OpenSSF): Reflection and Future][14] appeared first on [Linux Foundation][15].
--------------------------------------------------------------------------------
via: https://www.linux.com/news/open-source-security-foundation-openssf-reflection-and-future/
作者:[The Linux Foundation][a]
选题:[lujun9972][b]
译者:[cool-summer-021](https://github.com/cool-summer-021)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxfoundation.org/en/blog/openssf-reflection-and-future/
[b]: https://github.com/lujun9972
[1]: https://openssf.org/
[2]: https://www.linuxfoundation.org/en/press-release/technology-and-enterprise-leaders-combine-efforts-to-improve-open-source-security/
[3]: https://openssf.org/blog/2020/10/29/announcing-secure-software-development-edx-course-sign-up-today/
[4]: https://openssf.org/blog/2020/11/06/security-scorecards-for-open-source-projects/
[5]: https://github.com/ossf/criticality_score
[6]: https://github.com/ossf/Project-Security-Metrics
[7]: https://openssf.org/blog/2020/12/09/introducing-the-openssf-cve-benchmark/
[8]: https://owasp.org/www-project-security-knowledge-framework/
[9]: https://www.linuxfoundation.org/en/press-release/new-open-source-contributor-report-from-linux-foundation-and-harvard-identifies-motivations-and-opportunities-for-improving-software-security/
[10]: https://bestpractices.coreinfrastructure.org/
[11]: https://openssf.org/blog/2020/11/23/openssf-town-hall-recording-now-available/
[12]: https://owasp.org/www-project-integration-standards/
[13]: mailto:dwheeler@linuxfoundation.org
[14]: https://www.linuxfoundation.org/en/blog/openssf-reflection-and-future/
[15]: https://www.linuxfoundation.org/

View File

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

View File

@ -2,7 +2,7 @@
[#]: via: "https://opensource.com/article/21/2/simplicity"
[#]: author: "Alex Bunardzic https://opensource.com/users/alex-bunardzic"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: translator: "toknow-gh"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "

View File

@ -1,71 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why programmers love Linux packaging)
[#]: via: (https://opensource.com/article/21/2/linux-packaging)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Why programmers love Linux packaging
======
Programmers can distribute their software easily and consistently via
Flatpaks, letting them focus on their passion: Programming.
![Package wrapped with brown paper and red bow][1]
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. Today, I'll talk about what makes packaging for Linux ideal for programmers.
Programmers love to program. That probably seems like an obvious statement, but it's important to understand that developing software involves a lot more than just writing code. It includes compiling, documentation, source code management, install scripts, configuration defaults, support files, delivery format, and more. Getting from a blank screen to a deliverable software installer requires much more than just programming, but most programmers would rather program than package.
### What is packaging?
When food is sent to stores to be purchased, it is packaged. When buying directly from a farmer or from an eco-friendly bulk or bin store, the packaging is whatever container you've brought with you. When buying from a grocery store, packaging may be a cardboard box, plastic bag, a tin can, and so on.
When software is made available to computer users at large, it also must be packaged. Like food, there are several ways software can be packaged. Open source software can be left unpackaged because users, having access to the raw code, can compile and package it themselves. However, there are advantages to packages, so applications are commonly delivered in some format specific to the user's platform. And that's where the problems begin, because there's not just one format for software packages.
For the user, packages make it easy to install software because all the work is done by the system's installer. The software is extracted from its package and distributed to the appropriate places within the operating system. There's little opportunity for anything to go wrong.
For the software developer, however, packaging means that you have to learn how to create a package—and not just one package, but a unique package for every operating system you want your software to be installable on. To complicate matters, there are multiple packaging formats and options for each operating system, and sometimes even for the programming language being used.
### Packaging on Linux
Packaging options for Linux have traditionally seemed pretty overwhelming. Linux distributions derived from Fedora, such as Red Hat and CentOS, default to `.rpm` packages. Debian and Ubuntu (and similar) default to `.deb` packages. Other distributions may use one or the other, or neither, opting for a custom format. When asked, many Linux users say that ideally, a programmer won't package their software for Linux at all but instead rely on the package maintainers of each distribution to create the package. All software installed onto any Linux system ought to come from that distribution's official repository. However, it remains unclear how to get your software reliably packaged and included by one distribution, let alone all distributions.
### Flatpak for Linux
The Flatpak packaging system was introduced to unify and decentralize Linux as a delivery target for developers. With Flatpak, either a developer or anyone (a member of a Linux community, a different developer, a Flatpak team member, or anyone else) is free to package software. They can then submit the package to Flathub or choose to self-host the package and offer it to basically any Linux distribution. The Flatpak system is available to all Linux distributions, so targeting one is the same as targeting them all.
### How Flatpak technology works
The secret to Flatpak's universal appeal is a standard base. The Flatpak system allows developers to reference a common set of Software Developer Kit (SDK) modules. These are packaged and managed by the maintainers of the Flatpak system. The SDKs get pulled in as needed whenever you install a Flatpak, ensuring compatibility with your system. Any given SDK is only required once because the libraries it contains can be shared across any Flatpak calling for it.
If a developer requires a library not already included in an existing SDK, the developer can add that library in the Flatpak.
The results speak for themselves. Users may install hundreds of packages on any Linux distribution from one central repository, called [Flathub][2].
### How developers use Flatpaks
Flatpaks are designed to be reproducible, so the build process is easily integrated into a CI/CD workflow. A Flatpak is defined in a [YAML][3] or JSON manifest file. You can create your first Flatpak by following my [introductory article][4], and you can read the full documentation at [docs.flatpak.org][5].
### Linux makes it easy
Creating software on Linux is easy, and packaging it up for Linux is simple and automatable. If you're a programmer, Linux makes it easy for you to forget about packaging by targeting one system and integrating that into your build process.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/2/linux-packaging
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brown-package-red-bow.jpg?itok=oxZYQzH- (Package wrapped with brown paper and red bow)
[2]: https://flatpak.org/setup/
[3]: https://www.redhat.com/sysadmin/yaml-beginners
[4]: https://opensource.com/article/19/10/how-build-flatpak-packaging
[5]: https://docs.flatpak.org/en/latest/index.html

View File

@ -1,148 +0,0 @@
[#]: subject: "Learn everything about computers with this Raspberry Pi kit"
[#]: via: "https://opensource.com/article/21/9/raspberry-pi-crowpi2"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Learn everything about computers with this Raspberry Pi kit
======
The CrowPi is an amazing Raspberry Pi project system housed in a
laptop-like body.
![Teacher or learner?][1]
I like history, and I like computers, so I enjoy hearing stories about computing before computers were an everyday household appliance, much less a personal accessory. [One tale I hear often][2] is about how the computers of long ago (in computer years, anyway) were pleasantly basic. They were so basic, in fact, that it was relatively trivial for a curious user to figure out how to program one. Looking at modern computers, with object-oriented programming languages, complex GUI frameworks, network APIs, containers, and more, there's genuine concern that the tools of the computing trade have become essentially inaccessible to anyone without specialized training.
From the day the Raspberry Pi was released in 2012, it has always been intended as an educational platform. Several third-party vendors support the Pi with add-ons and training kits to help learners of all ages explore programming, physical computing, and open source. However, until recently, it's largely been up to the user to figure out how all the pieces on the market fit together. And then I got a CrowPi.
![CrowPi more than a laptop][3]
The CrowPi is not a laptop.
(Seth Kenlon, [CC BY-SA 4.0][4])
### Introducing the CrowPi2
Crows are surprisingly intelligent birds. They recognize and remember faces, mimic sounds they've heard, solve complex puzzles, and even use tools to accomplish a task. It's fitting that the CrowPi uses the crow as its logo and namesake because this device is packed with opportunities for exploration, experimentation, education, and, best of all, fun.
The design itself is clever: It looks like a laptop, but it's much more than that. When you lift the Bluetooth keyboard from the case, it reveals a hidden electronics workshop, complete with an LCD screen, 16 buttons, dials, RFID sensor, proximity sensor, breadboard, speakers, GPIO connections, a LED array, and much more. _And it's all programmable._
As its name implies, the unit itself is powered entirely by a Raspberry Pi, securely fastened within the underside of the case.
![crowpi pi board][5]
The CrowPi Pi board.
(Seth Kenlon, [CC BY-SA 4.0][4])
By default, you're meant to power the unit with a power adapter, and it ships with a wall adapter that you can plug into the case rather than powering the Pi directly. You can also use a battery supply plugged into an external micro-USB port. There's even a drawer built into the case so you can store your battery pack. When you do this, there's a USB cable popping out of the battery drawer and into the case power port, so there's no illusion that this is a "normal" laptop. However, with a device like this, that's pretty much the desired aesthetic!
### First boot
The CrowPi2 ships with Raspbian installed on a microSD card labeled **System**, although it includes a second microSD card loaded with [RetroPie][6], too. Being a responsible adult, I booted RetroPie first, naturally.
RetroPie is always fun, and the CrowPi2 ships with two SNES-style game controllers to ensure you have the optimal retro gaming experience.
Booting to the actual system is, amazingly, just as fun and arguably more so. The login manager is a custom project hub with quick links to sample coding projects, the Python and Arduino IDEs, Scratch, sample Python games, Minecraft, and more. You can also choose to exit the project hub and just use the desktop.
![CrowPi hub][7]
The CrowPi Hub.
(Seth Kenlon, [CC BY-SA 4.0][4])
The desktop is familiar to anyone used to the Raspberry Pi or Linux in general, but it's basic enough that it's easy to learn, too. There's an application menu in the top left, shortcut icons on the desktop, a system tray for network selection and volume control in the top right, and so on.
![CrowPi Desktop][8]
The CrowPi Desktop.
(Seth Kenlon, [CC BY-SA 4.0][4])
There's so much available on the CrowPi that it might be difficult to decide where to start. For me, there were four broad categories: Programming, physical electronics, Linux, and gaming.
There's an instruction manual in the box, so you know what you need to connect (for instance, the keyboard is battery-powered, so it does need charging sometimes, and it and the mouse always require a USB dongle). It's a quick read, though, and just one of the many examples of how seriously the CrowPi team takes documentation.
![CrowPi Docs][9]
The CrowPi Docs.
(Seth Kenlon, [CC BY-SA 4.0][4])
### Programming
If you're keen to learn how to code, there are many paths to success on the CrowPi. You should take the path that you find the most satisfying.
#### 1\. Scratch
[Scratch][10] is a simple visual coding application that lets you make games and interactive stories using code blocks that fit together like [Lego pieces][11]. It's the easiest way to begin coding, and I've seen kids as young as eight spend hours puzzling over the optimal algorithm for a game of their own design. Of course, it's not only great for kids! Adults can have a lot of fun with it, too. Not sure where to start? There's a 99-page booklet (printed on actual paper) in the box with Scratch lessons and projects for you to try.
#### 2\. Java and Minecraft
Minecraft is not open source (although there are [several open source projects][12] that reimplement it), but there's enough source available that it's often used to teach programming. Minecraft was written in Java, and the CrowPi ships with both [Minecraft Pi Edition][13] and the [BlueJ Java IDE][14] to make learning Java easier and more fun than ever.
#### 3\. Python and PyGame
There are several really fun games on the CrowPi that were written in Python and the [PyGame game engine][15]. You can play the games and then look at the source code to find out how the game works. The Geany, Thonny, and [Mu][16] editors are included on the CrowPi, so you can start programming in Python right away. As with Scratch, there's a booklet in the box with lessons so you can learn Python basics.
### Electronics
The physical electronics workshop concealed under the keyboard is essentially an array of Pi Hats. The whole thing is mapped out on a fold-out diagram in both English and Chinese so that you can identify all the components. There are plenty of sample projects to get you started. Here's a small list:
* **Hello** prints "hello" on the LCD screen when you speak to the CrowPi.
* **Intrusion alarm** sounds an alarm using the proximity sensor.
* **Remote controller** enables you to use a remote control (yes, this too is included in the box) to trigger events on the CrowPi.
* **RGB Tetris** lets you play a game of Tetris on an LED display.
* **Voice recognition** demonstrates natural language processing.
* **Ultrasonic music** creates a rudimentary Theramin using distance sensors and a speaker.
Those projects are just the beginning because you can build upon what exists. There's more to explore, of course. Patch cables, resistors, LEDs, and all sorts of components are included in the box so that you can learn all about the Pi's GPIO capabilities at your leisure.
One problem: The location of the sample projects is a little difficult to find. It's easy to find the demos (they're on the CrowPi hub screen), but the location of the source code isn't immediately obvious. It turns out that most of the sample projects are in `/usr/share/code`, which you can reach either through the file manager or a terminal.
![CrowPi Peripherals][17]
The CrowPi Peripherals
(Seth Kenlon, [CC BY-SA 4.0][4])
### Linux
The Raspberry Pi runs Linux. If you've been meaning to learn more about Linux, the CrowPi is a great platform for that, too. You can explore the desktop, the terminal, and nearly any Linux or open source application you can find. If you've been reading about open source for years and are ready to dive into an open source OS, this could be a platform for that (and much more, obviously).
### Gaming
The **RetroPie** SD card included in the box means you can reboot into a retro game console and play any number of old-school arcade games. It's not exactly a Steam Deck, but it's a fun and inspiring little gaming platform. Because it comes with not one but two game controllers, it's ideal for couch co-op. And best of all, you not only can play games on the CrowPi, but you can make your own games, too.
### Screwdriver included
I got to sit down with the CrowPi2 for about two weeks, and I've barely been able to get through all of the projects. There have been many nights when I've had to force myself to step away from it because even after I've tired of one project, I inevitably find something else to explore. To sum it up, I found one component in particular in the box, and I immediately knew that the CrowPi and I were well suited to one another: It was a small, humble screwdriver. There's no voiding of warranty stickers here. The CrowPi wants you to tinker, to take things apart, explore, and learn. This isn't a laptop or even just a Pi; this is a portable, low-powered, diverse, and open source learner's toolkit.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/raspberry-pi-crowpi2
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?)
[2]: https://opensource.com/article/21/8/my-first-programming-language
[3]: https://opensource.com/sites/default/files/crowpi-not-laptop.jpeg (CrowPi more than a laptop)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/crowpi-pi.jpeg (crowpi pi board)
[6]: https://opensource.com/article/19/1/retropie
[7]: https://opensource.com/sites/default/files/crowpi-hub.png (CrowPi hub)
[8]: https://opensource.com/sites/default/files/crowpi-desktop.png (CrowPi desktop)
[9]: https://opensource.com/sites/default/files/crowpi-docs.jpeg (CrowPi docs)
[10]: https://opensource.com/article/20/9/scratch
[11]: https://opensource.com/article/20/6/open-source-virtual-lego
[12]: https://opensource.com/alternatives/minecraft
[13]: https://www.minecraft.net/en-us/edition/pi
[14]: https://opensource.com/article/20/7/ide-java#bluej
[15]: https://opensource.com/downloads/python-gaming-ebook
[16]: https://opensource.com/article/18/8/getting-started-mu-python-editor-beginners
[17]: https://opensource.com/sites/default/files/crowpi-peripherals.jpeg (CrowPi peripherals)

View File

@ -1,112 +0,0 @@
[#]: subject: "9 ways to use open source every day"
[#]: via: "https://opensource.com/article/21/10/open-source-tools"
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
[#]: collector: "lujun9972"
[#]: translator: "XiaotingHuang22"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
9 ways to use open source every day
======
You may be surprised to learn that the tools you use every day are open
source.
![Tools illustration][1]
Recently I was invited to present on free and open resources that are available on the web. This presentation was part of a local effort to keep our community working—sponsored by the [Foster Center][2] at St. Bonaventure University near my home. Some of the resources I shared were not open source and merely cost $0, but many of the tools were also open source.
It was interesting to see how many folks recognized the tools I mentioned. Many people are unaware that the tools they use every day are open source, and they can share them with others. 
### Open source browsers
Using the web requires a good browser, and [Firefox is open source][3], which some of the folks I was presenting to were unaware of. In addition to being open source, Firefox is strongly conscious of privacy, which is a growing concern for many users. Interestingly, though, even Microsoft's new browser is based on the open source Chromium project. 
### Open source web privacy
Another way to protect your privacy and improve your web experience, in general, is to use uBlock Origin to block advertisements. According to their website:
> uBlock Origin is a free and open source, cross-platform browser extension for content filtering—primarily aimed at neutralizing privacy invasion in an efficient, user-friendly method.
The code is [GPL v. 3.0][4]. 
The Electronic Frontier Foundation (EFF) also maintains [Privacy Badger][5], a web browser extension licensed under the GPL v.3.0. According to their Github repository, it's:
> A browser extension that automatically learns to block invisible trackers. Instead of keeping lists of what to block, Privacy Badger automatically discovers trackers based on their behavior.
In addition to privacy, my presentation shared the importance of secure passwords. My audience learned about [Bitwarden][6]. Many folks had no idea how to generate secure passwords, differentiate from one website to another, and store them securely. I demonstrated how the software worked to create passwords and use Bitwarden to store those passwords in the cloud. I explained how users could access those credentials as browser plugins, desktop and laptop applications, and on Android or iOS mobile devices. 
### Open source messaging
I spoke of the ubiquity of text messaging but also its inherent insecurity. The audience was not aware of [Signal][7]. I have been using Signal for a couple of years and regularly encourage others to consider it as a secure messaging platform. It is easy to [install Signal][8] on Linux, macOS, Windows, [Android][9], and [iOS][10], and it offers excellent support [documentation][11] with detailed installation instructions for each operating system. Signal uses your existing mobile number, provided it can send and receive SMS and phone calls. The first time you set up Signal on your mobile phone, the application can search your address books for any of your contacts using Signal. 
### Open source office tools
No presentation on open source tools is complete without mentioning my favorite content creation tool, which is [LibreOffice][12]. Despite its popularity, many are unaware that it exists and the freedom that comes with its use. I use it every day to write articles. I use it instead of Excel, and sometimes I used it for presentations. You can download it and install it for Linux, macOS, and Windows. One of the beauties of LibreOffice is that you really own your documents. You don't need an expensive program to access them.
### Open source blog builder
[WordPress][13] is my favorite blogging engine, and there are myriad ways you can use it, whether sharing your own opinions on world events, a low-cost writing platform for your [students][14], or a web presence for your [business][15].
### Open source media repository
While creating content, you will need images that you can easily and legally share to illustrate your work. [OpenClipart][16] is my go-to. There are thousands of images available in various popular formats for inclusion in your LibreOffice documents and blog posts. In addition, you can find images that you can share with the proper attribution by visiting [Creative Commons][17]. Creative Commons offers licensing that makes sharing easier. Creative Commons is an extension of copyright that makes sharing easier. Be sure to familiarize yourself with the nuances of the licenses. 
### Open source video conferencing
The pandemic has changed the paradigm for conferences and meetups. Jitsi, Big Blue Button, and several others have revolutionized how we interact and learn as reported [here][18] by Chris Hermansen. 
### Open source educational resources
Open educational resources have liberated learning. With [OER Commons][19], you can find content to meet your needs, from pre-kindergarten to graduate and professional degrees, and it is openly licensed so that you can use it and share it with others. Massachusetts Institute of Technology (MIT) Open Courseware is nearly all of MIT's undergraduate and graduate content offered under a Creative Commons [non-commercial share-alike][20] license. [OpenStax][21], an open textbook initiative at Rice University, offers peer-reviewed textbooks that are openly licensed and available for free. 
### Open source podcast tools
Podcasts have become a great way to catch up on the latest [open source news][22] for me. Have you thought of starting your own podcast? There are a couple of great open source tools that I am familiar with that provide ways to make that a reality. [Audacity][23] is my favorite recording application. I have used it to flip my classroom instruction, record interviews, and experiment with sound effects. It is a 16-track audio editor that you can use in a variety of ways. If you have something to say or a skill to teach, you should use [Open Broadcaster Software][24].
### Linux
Finally, introduce your friends to Linux, which many of them still don't know about, and let them experience all the readily available free software. 
In addition to the talk recorded and shared on [YouTube][25], I compiled a list of links to the resources and shared them on [GitHub][26].
There are lots of non-code ways to contribute to open source: Here are three alternatives.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/10/open-source-tools
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl (Tools illustration)
[2]: https://www.sbu.edu/academics/schools-at-sbu/school-of-business/foster-center-for-responsible-leadership/foster-center-events
[3]: https://opensource.com/article/21/9/switch-to-firefox
[4]: https://github.com/gorhill/uBlock
[5]: https://privacybadger.org/
[6]: https://github.com/bitwarden
[7]: https://opensource.com/article/19/10/secure-private-messaging
[8]: https://signal.org/download/
[9]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&referrer=utm_source%3DOWS%26utm_medium%3DWeb%26utm_campaign%3DNav
[10]: https://apps.apple.com/us/app/signal-private-messenger/id874139669
[11]: https://support.signal.org/
[12]: https://opensource.com/article/21/9/libreoffice-tips
[13]: https://opensource.com/article/18/10/setting-wordpress-raspberry-pi
[14]: https://opensource.com/article/20/4/wordpress-virtual-machine
[15]: https://opensource.com/article/21/3/wordpress-plugins-retail
[16]: https://openclipart.org/
[17]: https://search.creativecommons.org/
[18]: https://opensource.com/article/20/5/open-source-video-conferencing
[19]: https://www.oercommons.org/
[20]: https://ocw.mit.edu/help/faq-cite-ocw-content/
[21]: https://openstax.org/
[22]: https://opensource.com/article/19/10/linux-podcasts-Jupiter-Broadcasting
[23]: https://opensource.com/article/20/4/audacity
[24]: https://opensource.com/article/20/4/open-source-live-stream
[25]: https://youtu.be/aUgaYtN_sUU
[26]: https://github.com/donwatkins/Presentations/blob/master/fostercenter.md

View File

@ -1,223 +0,0 @@
[#]: subject: "Write your first CI/CD pipeline in Kubernetes with Tekton"
[#]: via: "https://opensource.com/article/21/11/cicd-pipeline-kubernetes-tekton"
[#]: author: "Savita Ashture https://opensource.com/users/savita-ashture"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Write your first CI/CD pipeline in Kubernetes with Tekton
======
Tekton is a Kubernetes-native open source framework for creating
continuous integration and continuous delivery (CI/CD) systems.
![Plumbing tubes in many directions][1]
Tekton is a Kubernetes-native open source framework for creating continuous integration and continuous delivery (CI/CD) systems. It also helps to do end-to-end (build, test, deploy) application development across multiple cloud providers or on-premises systems by abstracting away the underlying implementation details.
### Introduction to Tekton
[Tekton][2], known initially as [Knative Build][3], later got restructured as its own open source project with its own [governance organization][4] and is now a [Linux Foundation][5] project. Tekton provides an in-cluster container image build and deployment workflow—in other words, it is a continuous integration (CI) and continuous delivery (CD) service. It consists of Tekton Pipelines and several supporting components, such as Tekton CLI, Triggers, and Catalog.
Tekton is a Kubernetes native application. It installs and runs as an extension on a Kubernetes cluster and comprises a set of Kubernetes Custom Resources that define the building blocks you can create and reuse for your pipelines. Because it's a K-native technology, Tekton is remarkably easy to scale. When you need to increase your workload, you can just add nodes to your cluster. It's also easy to customize because of its extensible design and thanks to a community repository of contributed components.
Tekton is ideal for developers who need CI/CD systems to do their work and platform engineers who build CI/CD systems for developers in their organization.
### Tekton components
Building CI/CD pipelines is a far-reaching endeavor, so Tekton provides tools for every step of the way. Here are the major components you get with Tekton:
* **Pipeline: **Pipeline defines a set of Kubernetes [Custom Resources][6] that act as building blocks you use to assemble your CI/CD pipelines.
* **Triggers: **Triggers is a Kubernetes Custom Resource that allows you to create pipelines based on information extracted from event payloads. For example, you can trigger the instantiation and execution of a pipeline every time a merge request gets opened against a Git repository.
* **CLI:** CLI provides a command-line interface called `tkn` that allows you to interact with Tekton from your terminal.
* **Dashboard:** Dashboard is a web-based graphical interface for Tekton pipelines that displays information about the execution of your pipelines.
* **Catalog:** Catalog is a repository of high-quality, community-contributed Tekton building blocks (tasks, pipelines, and so on) ready for use in your own pipelines.
* **Hub:** Hub is a web-based graphical interface for accessing the Tekton catalog.
* **Operator:** Operator is a Kubernetes [Operator pattern][7] that allows you to install, update, upgrade, and remove Tekton projects on a Kubernetes cluster.
* **Chains: **Chains is a Kubernetes Custom Resource Definition (CRD) controller that allows you to manage your supply chain security in Tekton. It is currently a work-in-progress.
* **Results: **Results aims to help users logically group CI/CD workload history and separate out long-term result storage away from the pipeline controller.
### Tekton terminology
![Tekton terminology][8]
(Source: [Tekton documentation][9])
* **Step:** A step is the most basic entity in a CI/CD workflow, such as running some unit tests for a Python web app or compiling a Java program. Tekton performs each step with a provided container image.
* **Task:** A task is a collection of steps in a specific order. Tekton runs a task in the form of a [Kubernetes pod][10], where each step becomes a running container in the pod.
* **Pipelines:** A pipeline is a collection of tasks in a specific order. Tekton collects all tasks, connects them in a directed acyclic graph (DAG), and executes the graph in sequence. In other words, it creates a number of Kubernetes pods and ensures that each pod completes running successfully as desired.
![Tekton pipelines][11]
(Source: [Tekton documentation][12])
* **PipelineRun: **A PipelineRun, as its name implies, is a specific execution of a pipeline.
* **TaskRun:** A TaskRun is a specific execution of a task. TaskRuns are also available when you choose to run a task outside a pipeline, with which you may view the specifics of each step execution in a task.
### Create your own CI/CD pipeline
The easiest way to get started with Tekton is to write a simple pipeline of your own. If you use Kubernetes every day, you're probably comfortable with YAML, which is precisely how Tekton pipelines are defined. Here's an example of a simple pipeline that clones a code repository.
First, create a file called `task.yam`**l** and open it in your favorite text editor. This file defines the steps you want to perform. In this example, that's cloning a repository, so I've named the step clone. The file sets some environment variables and then provides a simple shell script to perform the clone.
Next comes the task. You can think of a step as a function that gets called by the task, and the task sets parameters and workspaces required for steps.
```
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
 name: git-clone
spec:
 workspaces:
   - name: output
     description: The git repo will be cloned onto the volume backing this Workspace.
 params:
   - name: url
     description: Repository URL to clone from.
     type: string
   - name: revision
     description: Revision to checkout. (branch, tag, sha, ref, etc...)
     type: string
     default: ""
 steps:
   - name: clone
     image: "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.21.0"
     env:
       - name: PARAM_URL
         value: $(params.url)
       - name: PARAM_REVISION
         value: $(params.revision)
       - name: WORKSPACE_OUTPUT_PATH
         value: $(workspaces.output.path)
     script: |
      #!/usr/bin/env sh
       set -eu
       CHECKOUT_DIR="${WORKSPACE_OUTPUT_PATH}"
       /ko-app/git-init \
         -url="${PARAM_URL}" \
         -revision="${PARAM_REVISION}" \
         -path="${CHECKOUT_DIR}"
       cd "${CHECKOUT_DIR}"
       EXIT_CODE="$?"
       if [ "${EXIT_CODE}" != 0 ] ; then
         exit "${EXIT_CODE}"
       fi
       # Verify clone is success by reading readme file.
       cat ${CHECKOUT_DIR}/README.md
```
Create a second file called `pipeline.yaml`, and open it in your favorite text editor. This file defines the pipeline by setting important parameters, such as a workspace where the task can be run and processed.
```
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
 name: cat-branch-readme
spec:
 params:
   - name: repo-url
     type: string
     description: The git repository URL to clone from.
   - name: branch-name
     type: string
     description: The git branch to clone.
 workspaces:
   - name: shared-data
     description: |
      This workspace will receive the cloned git repo and be passed
       to the next Task for the repo's README.md file to be read.
 tasks:
   - name: fetch-repo
     taskRef:
       name: git-clone
     workspaces:
       - name: output
         workspace: shared-data
     params:
       - name: url
         value: $(params.repo-url)
       - name: revision
         value: $(params.branch-name)
```
Finally, create a file called `pipelinerun.yaml` and open it in your favorite text editor. This file actually runs the pipeline. It invokes parameters defined in the pipeline (which, in turn, invokes the task defined by the task file.)
```
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
 name: git-clone-checking-out-a-branch
spec:
 pipelineRef:
   name: cat-branch-readme
 workspaces:
   - name: shared-data
     volumeClaimTemplate:
       spec:
         accessModes:
          - ReadWriteOnce
         resources:
           requests:
             storage: 1Gi
 params:
   - name: repo-url
     value: <https://github.com/tektoncd/pipeline.git>
   - name: branch-name
     value: release-v0.12.x
```
The advantage of structuring your work in separate files is that the `git-clone` task is reusable for multiple pipelines.
For example, suppose you want to do end-to-end testing for a pipeline project. You can use the `git-clone`** **task to ensure that you have a fresh copy of the code you need to test.
### Wrap up
As long as you're familiar with Kubernetes, getting started with Tekton is as easy as adopting any other K-native application. It has plenty of tools to help you create pipelines and to interface with your pipelines. If you love automation, try Tekton!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/11/cicd-pipeline-kubernetes-tekton
作者:[Savita Ashture][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/savita-ashture
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions)
[2]: https://github.com/tektoncd/pipeline
[3]: https://github.com/knative/build
[4]: https://cd.foundation/
[5]: https://www.linuxfoundation.org/projects/
[6]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
[7]: https://operatorhub.io/what-is-an-operator
[8]: https://opensource.com/sites/default/files/uploads/tekto-terminology.png (Tekton terminology)
[9]: https://tekton.dev/docs/concepts/concept-tasks-pipelines.png
[10]: https://kubebyexample.com/en/concept/pods
[11]: https://opensource.com/sites/default/files/uploads/tekton-pipelines.png (Tekton pipelines)
[12]: https://tekton.dev/docs/concepts/concept-runs.png

View File

@ -1,100 +0,0 @@
[#]: subject: "5 open source alternatives to Microsoft Exchange"
[#]: via: "https://opensource.com/article/21/11/open-source-alternatives-microsoft-exchange"
[#]: author: "Heike Jurzik https://opensource.com/users/hej"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
5 open source alternatives to Microsoft Exchange
======
There is no need to settle for a proprietary solution. Try one of these
Linux-based email and groupware services.
![Working on a team, busy worklife][1]
For decades, Microsoft Exchange has ruled the market for email and groupware services. This top dog dominates the corporate world, and the omnipresent Outlook mail client has become the de facto standard for groupware. Since Exchange is closely integrated with Microsoft's Office products, users have access to a wide variety of productivity software and features, whether they're using a desktop or a mobile client.
However, many companies have concerns about storing their data in the Microsoft cloud. In this article, I look at some open source alternatives and their advantages. It's not just about becoming vendor-independent and reducing costs; it's about using software with open standards and a different level of security—for the groupware server itself and the operating system behind it.
All five alternatives in this article are Linux-based. While grommunio, Kopano, Nextcloud, ownCloud, and the OX App Suite vary widely in functionality and are therefore attractive to different types of enterprises, they all provide free editions with the option to purchase paid support and add-ons. All candidates can either run on-prem or in the cloud. On top of that, all vendors offer a SaaS solution for their software.
### grommunio
[grommunio][2], formerly known as grammm, is published under the AGPLv3 license. It is developed and supported by the Austrian company of the same name. Unlike Exchange, grommunio offers a mail server that's standards-compliant as well as a fully functional groupware solution with features like email, contacts, calendar, tasks, file sharing, and more. grommunio works with various open source and proprietary mail clients, like Windows Mail, Outlook, Android, Apple Mail/iOS, Thunderbird, etc., and supports both the older RPC over HTTP protocol and the Outlook standard protocol MAPI over HTTP. Also included: Exchange ActiveSync for mobile devices and various standard protocols like CalDAV (calendar), CardDAV (address book), IMAP, POP3, SMTP, and LDAP, as well as Active Directory (for syncing of user accounts).
External open source applications provide some features not supported by Microsoft's API or protocols. For example, the developers have integrated [Jitsi][3] (video and audio telephony), [Mattermost][4] (chat), and file sharing and syncing ([ownCloud][5]). grommunio is also equipped with basic mobile device management (MDM).
grommunio is designed for a very large number of users and—just like Exchange—supports database sharding (horizontal distribution of databases across multiple hosts). The flexible storage backend allows administrators to extend their setup by adding other servers or cloud accounts. grommunio uses a MySQL database for metadata only, while all "content" such as mail and groupware objects are stored in a per-user SQLite database. For more information on the underlying architecture, please have a look at the [manufacturer's website][6].
The Community edition is free of charge and includes all grommunio features for up to five user accounts. 
### Kopano
[Kopano][7], from the German-Dutch software manufacturer Kopano, is also AGPLv3-licensed and based on the Zarafa software stack. Unlike its predecessor, Kopano doesn't aim to be a mere replacement for Exchange. Instead, it's a complete groupware solution and includes real-time communication in addition to the standard features of email, contacts, calendar, tasks, notes, and document editing. Kopano interacts with [many other platforms][8], applications, and services. Some of them can easily be integrated by plugins. For video conferencing, the Kopano team has developed its own open source solution based on WebRTC: Kopano Meet offers end-to-end encryption and is available for Windows, macOS, Linux, Android, and iOS.
Outlook clients are supported via ActiveSync (Z-Push library) or the [Kopano OL Extension][9] (KOE), which serves as an enhancement to the already included ActiveSync. Kopano offers a native web client (WebApp), a client for mobile devices (Mobility), and a desktop version (DeskApp) with support for Windows, Linux, and macOS. Connecting other clients is possible via IMAP, CalDAV, and CardDAV. All applications directly connecting to the Kopano Server use MAPI in SOAP (Simple Object Access Protocol).
Free community versions are available for Kopano Groupware and Kopano ONE (a special edition of the Kopano Groupware). Kopano Meet can be downloaded as an application or container.
### Nextcloud
[Nextcloud][10], with offices in Stuttgart and Berlin (Germany), is licensed under the AGPLv3. Like in ownCloud or Dropbox, users can access the software suite via their desktops (Windows, Linux, and macOS), web browsers, or native apps (Android and iOS). Since version 18, Nextcloud includes Nextcloud Talk (calls, chats, and web meetings) and Nextcloud Groupware (calendar, contacts, and mail) in addition to Nextcloud Files (file sync and share), and changed its name to Nextcloud Hub.
User and group administration happens via OpenID or LDAP. Various storage backends are supported, such as FTP, S3, and Dropbox. Nextcloud works with several database management systems, including PostgreSQL, MariaDB, SQLite, and Oracle Database. Admins can extend the functionality with more than 200 apps from the [Nextcloud app store][11]. Offerings include real-time communication, audio and video chat, task management, mail, and many more.
Nextcloud is completely free of charge. On top of that, the company offers a Nextcloud Enterprise build (pre-configured, optimized, and hardened for enterprise deployments). 
### ownCloud
[ownCloud][12] is a file sync, share, and content collaboration software developed and maintained by ownCloud GmbH in Nuremberg, Germany. The core of the client-server software and many community apps are published under the AGPLv3. Several enterprise apps which extend the functionality are licensed under the ownCloud Commercial License (OCL).
ownCloud is mainly a content collaboration software, including online office document editing, calendar, contact synchronization, etc. Mobile clients are available for Android and iOS, and the desktop app integrates into the native file managers in Windows, macOS, and Linux. The Web interface allows access without installing dedicated client software. ownCloud supports WebDAV, CalDAV, and CardDAV. LDAP is included, but ownCloud also connects to other Identity Providers supporting the OpenID Connect authentication standard.
ownCloud offers integrations for Microsoft Office Online Server, Office 365, and Microsoft Teams. Plugins for Microsoft Outlook and eM Client are available. If necessary, the External Storage Feature connects to different storage providers, like Amazon S3, Dropbox, Microsoft SharePoint, Google Drive, Windows network drives (SMB), and FTP. The vendor also offers additional features for enterprise customers, like end-to-end encryption, ransomware and antivirus protection, etc. (see the [full list of features][13]).
The Community edition is free of charge and 100% open source.  
### OX App Suite
[Open-Xchange][14] was founded in 2005 with headquarters in Olpe and Nuremberg, Germany. Today, OX has offices in various European countries, the USA, and Japan. The [OX App Suite][15] is a modular email, communication, and collaboration platform, mainly designed for telcos, hosting companies, and other providers delivering cloud-based services.
The backend is released under the GPLv2, the frontend (UI) under the AGPLv3. Users can access the app suite via their preferred browser (fully customizable portal) or a mobile app (Android and iOS). Alternatively, native clients (mobile devices and desktops) are available for OX Mail and OX Drive. Thanks to CardDAV and CalDAV extensions, Exchange Active Sync, and the OX Sync App for Android, synchronization of contacts, calendars, and tasks is possible.
OX App Suite contains apps for email, contacts, calendars, and tasks. Additional tools and extensions—some open source, some paid features—are available, including OX Documents (text documents, spreadsheets, presentations), OX Drive (manage, share, and synchronize files), OX Guard (encryption of emails and files), and more. For a complete list, please visit the OX website for [general terms and conditions][16].
A community edition with limited features is available at no charge.  
### Open source email and groupware
Email and groupware services don't have to cost (lots of) money, and there is certainly no need to settle for a proprietary solution hosted on someone else's server. If you're not too keen on the administrative responsibilities, though, all five open source Exchange alternatives are available as SaaS solutions. Alternatively, all vendors offer professional tech support, and you can run the software on-premise—always in control, but never alone.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/11/open-source-alternatives-microsoft-exchange
作者:[Heike Jurzik][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/hej
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_dev_email_chat_video_work_wfm_desk_520.png?itok=6YtME4Hj (Working on a team, busy worklife)
[2]: https://grommunio.com/
[3]: https://opensource.com/article/20/5/open-source-video-conferencing
[4]: https://opensource.com/article/20/7/mattermost
[5]: https://opensource.com/article/21/7/owncloud-windows-files
[6]: https://grommunio.com/features/architecture/
[7]: https://kopano.com/
[8]: https://kopano.com/products/interoperability/
[9]: https://kb.kopano.io/display/WIKI/Setting+up+the+Kopano+OL+Extension
[10]: https://nextcloud.com/
[11]: https://apps.nextcloud.com/
[12]: https://owncloud.com/
[13]: https://owncloud.com/features/
[14]: https://www.open-xchange.com/
[15]: https://www.open-xchange.com/products/ox-app-suite/
[16]: https://www.open-xchange.com/terms-and-conditions/

View File

@ -2,7 +2,7 @@
[#]: via: "https://opensource.com/article/21/12/open-source-mind-mapping-drawio"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: translator: "FYJNEVERFOLLOWS "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
@ -93,7 +93,7 @@ via: https://opensource.com/article/21/12/open-source-mind-mapping-drawio
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[FYJNEVERFOLLOWS](https://github.com/FYJNEVERFOLLOWS)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,173 +0,0 @@
[#]: subject: "OpenWrt, an open source alternative to firmware for home routers"
[#]: via: "https://opensource.com/article/22/7/openwrt-open-source-firmware"
[#]: author: "Stephan Avenwedde https://opensource.com/users/hansic99"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
OpenWrt, an open source alternative to firmware for home routers
======
OpenWrt is a Linux-based, open source operating system targeting embedded network devices.
If you're reading this article from home, you are probably connected with a LTE/5G/DSL/WIFI router. Such devices are usually responsible to route packets between your local devices (smartphone, PC, TV, and so on) and provide access to the world wide web through a built-in modem. Your router at home has most likely a web-based interface for configuration purposes. Such interfaces are often oversimplified as they are made for casual users.
If you want more configuration options, but don't want to spend for a professional device you should take a look at an alternative firmware such as [OpenWrt][2].
### OpenWrt features
OpenWrt is a Linux-based, open source operating system targeting embedded network devices. It is mainly used as a replacement for the original firmware on home routers of all kinds. OpenWrt comes with all the useful features a good router should have like a DNS server ([dnsmasq][3]), Wifi access point and client functionality, PPP protocol for modem functionality and, unlike with the standard firmware, everything is fully configurable.
### LuCI Web Interface
OpenWrt can be configured remotely by command line (SSH) or using [LuCI][4], a GUI configuration interface. LuCI is a lightweight, extensible web GUI written in [Lua][5], which enables an exact configuration of your device. Besides configuration, LuCI provides a lot of additional information like real time graphs, system logs, and network diagnostics.
![LuCI web interface][6]
Image by: Stephan Avenwedde, [CC BY-SA][7]
There are some optional extensions available for LuCI to add even further configuration choices.
### Writeable file system
Another highlight is the writeable filesystem. While the stock firmware is usually read-only, OpenWrt comes with a writeable filesystem thanks to a clever solution that combines OverlayFS with SquashFS and JFFS2 filesystems to allow installation of packages to enhance functionality. Find more information about the file system architecture in the [OpenWrt documentation][8].
### Extensions
OpenWrt has an associated package manager, [opkg][9], which allows to install additional services. Some examples are an FTP server, a DLNA media server, an OpenVPN server, a Samba server to enable file sharing, or Asterisk (software to control telephone calls). Of course, some extensions require appropriate resources of the underlying hardware.
### Motivation
You might wonder why you should try to replace a router manufacture's firmware, risking irreparable damage to your device and loss of warranty. If your device works the way you want, then you probably shouldnt. Never touch a running system! But if you want to enhance functionality, or if your device is lacking configuration options, then you should check whether OpenWrt could be a remedy.
In my case, I wanted a travel router which I can place on an appropriate position when Im on a campsite in order to get a good connection to the local Wifi access point. The router should connect itself as an ordinary client and broadcasts its own access point for my devices. This allows me to configure all my devices to connect with the routers access points and I only have to change the routers client connection when Im somewhere else. Moreover, on some campsites you only get an access code for one single device, which I can enhance with this setup.
As my travel router, I choose the TP-Link TL-WR902AC for the following reasons:
* Small
* Two Wifi antennas
* 5V power supply (USB)
* Low power consumption
* Cost effective (you get it for around $30)
To get an idea of the size, here it is next to a Raspberry Pi4:
![TP-Link TL-WR902AC next to a Raspberry Pi][10]
Image by: Stephan Avenwedde, [CC BY-SA 4.0][11]
Even though the router brings all hardware capabilities I demand, I relatively quickly found out that the default firmware dont let me configure it the way I wanted. The router is mainly intended as an Wifi access point, which repeats an existing Wifi network or connects itself to the web over the onboard Ethernet interface. The default firmware is very limited for these use cases.
Fortunately, the router is capable of running OpenWrt, so I decided to replace the original firmware with it.
### Installation
When your LTE/5G/DSL/WIFI router meets the [minimum requirements][12], chances are high that it's possible to run OpenWrt on it. As the next step, you look in the [hardware table][13] and check whether your devices is listed as compatible, and which firmware package you have to choose. The page for the [TP-Link TL-WR902AC][14] also includes the installation instructions which describe how to flash the internal memory.
The process of flashing the firmware can vary between different devices, so I wont go into detail on this. In a nutshell, I had to connect the device over  a TFTP server on a network interface with a certain IP address, rename the OpenWrt firmware file and then boot up the device considering pressing the reset button.
### Configuration
Once flashing was successfully, your device should now boot up with the new firmware. It may take a bit longer now to boot up as OpenWrt comes with much more features compared to the default firmware.
OpenWrt acts as a DHCP server, so in order to begin with configuration, make a direct Ethernet connection between your PC and the router, and configure your PCs Ethernet adapter as a DHCP client.
On Fedora Linux, to activate the DHCP client mode for your network adapter, first you have to find out the connection UUID by running:
```
$ nmcli connection show
NAME          UUID         TYPE      DEVICE
Wired Conn 1  7a96b...27a  ethernet  ens33
virbr0        360a0...673  bridge   virbr0
testwifi      2e865...ee8  wifi     --
virbr0        bd487...227  bridge   --
Wired Conn 2  16b23...7ba  ethernet --
```
Pick the UUID for the connection you want to modify and then run:
```
$ nmcli connection modify <UUID> ipv4.method auto
```
You can find more information about these commands in the [Fedora Networking Wiki][15].
After you have a connection to your router, open a web browser and navigate to [http://openwrt/][16]. You should now see LuCIs login manager:
![LuCI login][17]
Use **root** as the username, and leave the password field blank.
### Configuring Wifi and routing
To configure your Wifi antennas, click on the **Network** menu and select **Wireless**.
![LuCI wireless configuration][19]
On my device, the antenna **radio0** on top operates in 2.4 GHz mode and is connected to the local access point called *MOBILE-INTERNET*. The antenna **radio1** below operates at 5 GHz and has an associated access point with the SSID *OpenWrt_AV*. With a click of the **Edit**button, you can open the device configuration to decide whether the device belongs to the *LAN* or WWAN network. In my case, the access point *OpenWrt_AV* belongs to the LAN network and the client connection *MOBILE-INTERNET* belongs to the WWAN network.
![LuCI configuration screen][21]
Configured networks are listed under **Network**, in the **Interfaces** panel.
![Device list][23]
In order to get the functionality I want, network traffic must be routed between the LAN and the WWAN network. The routing can be configured in the **Firewall** section of the **Network** panel. I didnt change anything here because, by default, the traffic is routed between the networks, and incoming packets (from WWAN to LAN) have to pass the firewall.
So all you need to know is whether an interface belongs to LAN or (W)WAN. This concept makes it relatively easy to configure, especially for beginners. You can find more information in [OpenWrts basic networking][25] guide.
### Captive portals
Public Wifi access points are often protected by a [captive portal][26] where you have to enter an access code or similar. Usually, such portals show up when you are first connected to the access point and try to open an arbitrary web page. This mechanism is realized by the access point's DNS server.
By default, OpenWrt has a security feature activated that prevents connected clients from a [DNS rebinding attack][27]. OpenWrts rebind protection also prevents captive portals from being forwarded to clients, so you must disable rebind protection so you can reach captive portals. This option is in the **DHCP and DNS** panel of the **Network** menu.
![Firewall settings][28]
### Try OpenWrt
Thanks to an upgrade to OpenWrt, I got a flexible travel router based on commodity hardware. OpenWrt makes your router fully configurable and extensible and, thanks to the well-made web GUI, it's also appropriate for beginners. There are even a few [select routers][30] that ship with OpenWrt already installed. You are also able to enhance your router's functionality with lots of [available packages][31]. For example, Im using the [vsftp][32] FTP server to host some movies and TV series on a connected USB stick. Take a look at the [projects homepage][33], where you can find many reasons to switch to OpenWrt.
Image by: Stephan Avenwedde, [CC BY-SA 4.0][7]
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/7/openwrt-open-source-firmware
作者:[Stephan Avenwedde][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/hansic99
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/OSDC_Internet_Cables_520x292_0614_RD.png
[2]: https://openwrt.org
[3]: https://thekelleys.org.uk/dnsmasq/doc.html
[4]: https://openwrt.org/docs/guide-user/luci/start
[5]: https://opensource.com/article/20/2/lua-cheat-sheet
[6]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_overview_c_0.png
[7]: https://creativecommons.org/licenses/by-sa/4.0/legalcode
[8]: https://openwrt.org/docs/techref/flash.layout
[9]: https://openwrt.org/docs/guide-user/additional-software/opkg
[10]: https://opensource.com/sites/default/files/2022-07/OpenWrt_Comparison_RaspberryPi.jpg
[12]: https://openwrt.org/supported_devices
[13]: https://openwrt.org/toh/start
[14]: https://openwrt.org/toh/tp-link/tl-wr902ac_v3
[15]: https://fedoraproject.org/wiki/Networking/CLI
[16]: http://openwrt/
[17]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_login_manager.png
[19]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_wireless_section_c.webp
[21]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_wifi_device_configuration.webp
[23]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_network_devices_0.webp
[25]: https://openwrt.org/docs/guide-user/base-system/basic-networking
[26]: https://en.wikipedia.org/wiki/Captive_portal
[27]: https://en.wikipedia.org/wiki/DNS_rebinding
[28]: https://opensource.com/sites/default/files/2022-07/openwrt_luci_firewall_settings.webp
[30]: https://opensource.com/article/22/1/turris-omnia-open-source-router
[31]: https://openwrt.org/packages/table/start
[32]: https://openwrt.org/docs/guide-user/services/nas/ftp.overview
[33]: https://openwrt.org/reasons_to_use_openwrt

View File

@ -2,7 +2,7 @@
[#]: via: "https://www.debugpoint.com/install-use-gnome-boxes/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "void-mori"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "

View File

@ -1,197 +0,0 @@
[#]: subject: "How to Install and Use htop in Linux"
[#]: via: "https://itsfoss.com/use-htop/"
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
[#]: collector: "lkxed"
[#]: translator: "perfiffer"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install and Use htop in Linux
======
Windows has its famous task manager. Linux has several GUI and [command line system monitors][1]. Every Linux system comes with a couple of them.
On the command line, the top command is perhaps the goto command for checking the system resource utilization quickly.
[Using top command][2] apart from viewing the processes could be tricky. And this is where htop tops top. Pun aside, htop is a top-like utility but with a better and user-friendly interface.
In this guide, I will be showing you how you can install and use htop in Linux.
### Install htop utility in Linux
You wont find htop pre-installed on the majority of Linux distributions but being one of the most popular utilities, you will find htop in default repositories of almost every Linux distro.
So if your machine is powered by something that is based on Debian/Ubuntu, the following command should get your job done:
```
sudo apt install htop
```
Similarly, if youre on Fedora, you can use the given command:
```
sudo dnf install htop
```
And theres also a snap package available if you like to avoid building packages from the source:
```
sudo snap install htop
```
If youre on something else or want to build from a source, you can always refer to [htops GitHub page][3] for detailed instructions.
Once youre done with the installation, you just have to use the htop command in the terminal, and it will reflect all the ongoing processes in your system:
```
htop
```
![install and use htop][4]
In htop, there is a color coding for the individual section, so lets have a look at what each color indicates while using htop.
##### What different colors and statistics indicate in htop
So lets start with the CPU usage bar, as it utilizes the maximum number of colors.
#### CPU usage bar
![cpu process in htop][5]
- **Green:** Resources consumed by user processes.
- **Blue:** Indicates low-priority threads.
- **Red:** CPU resources used by system (kernel) processes.
- **Aqua blue:** Indicates virtualized processes.
#### Memory bar
![memory bar in htop][6]
- **Green:** Memory being utilized by system processes.
- **Blue:** Memory used by buffer pages.
- **Orange:** Memory allocated for cache pages.
#### Statistics
![task statistics in htop][7]
- **1.86** is the average load for the last minute.
- **1.75** is the average load for the last 4 minutes.
- **1.47** is the average load for the last 15 minutes.
- **Tasks: 166** shows there is a total of 166 ongoing processes.
- **1249 thr** indicates that those 166 processes are handled by 1249 threads.
- **1 running** indicates that from those 166 processes, only one task is in a state of running.
- **The load** average indicates the average system load over a period of time. Since my system is Hexa-Core, anything under 6.0 is ok. This number may exceed, such as 6.1, so the upcoming processes have to wait for ongoing tasks to be completed.
- **Uptime** is nothing but hours since you logged in.
Now, lets jump to the actual implementation part.
### How to use htop in Linux
As the htop is mainly used to check for system resources, lets have a look at how you can sort the processes based on resource consumption.
#### Sort processes based on Resource Consumption
The easiest way to sort processes based on CPU and memory usage is to use your mouse pointer. Hover the cursor over the CPU or Memory section and click on any of those.
And there you will see an icon of a triangle `△` and based on that you can sort the process based on highest to lowest resource consumption:
But if you are dealing with remote servers, you might not have the privilege to use a mouse and in those cases, you can use keyboard shortcuts.
Press **F6** and it will bring up every option available to sort the ongoing processes:
![sort processes in htop using keyboard shortcut][8]
You can use arrow keys to select a preferred sorting option and then press the Enter key, results should reflect as intended.
#### Search for a specific process
If you want to look for a specific process and its resource consumption, you can press **F3** and it will get you a search prompt as shown below:
![search processes in htop][9]
For example, I searched for htop, and it highlighted the process with light orange color. And you can press **F3** for the next result.
#### Filter ongoing processes
While searching may get you the intended results, I find the filtering process using keywords even more effective as it presents a list of processes.
To filter processes, you have to press **F4** and type the name of the process. For example, I filtered processes related to gnome-boxes:
![filter processes in htop][10]
#### Kill process
Once you made it to find the most resource-hungry and unnecessary process, you just have to press **F9**, and it will present you with termination signals:
![kill process in htop][11]
I cant cover all 15 termination signals, we have a separate guide on [different termination signals][12], so you can refer to that guide if you intend to learn more about them.
But I will recommend you use SIGTERM first, as it is the most efficient and friendly way to kill the process.
#### Customize htop
Here, my aim is to add a date and time and change the color scheme to monochrome.
First, press **F2**, and it will being setup prompt allowing users to change how htop looks:
![customize htop in ubuntu][13]
First, hover to the `Colors` sections and press Enter and it will allow us to change the color scheme. From there, select the Monochrome option and press Enter to save changes:
![change htop colors in linux][14]
Now, go back to the setup option, and from there, use the left arrow key to explore available meters:
![explore available meters in htop][15]
As I intend to add the Date and time, I have to press Enter once I find the option for it.
Here, it will allow you to place the date and time in any of the left and right columns and you can use the up and down arrow keys to change the order of columns.
So I placed the date and time meter with the last styling option (you can change styles using the spacebar):
![add date and time htop][16]
Once you are done aligning the date and time meter, press the enter key to save changes and **F10** to close the setup prompt.
### Wrapping Up
In this guide, I explained how you can install the htop utility in different Linux distributions and how you can use some basic functionalities of htop to manage system resources efficiently.
But htop can do a lot more and for that and to learn more, you can always refer to its man page, and we have a detailed guide on [how you can get the most out of the man page in Linux][17].
--------------------------------------------------------------------------------
via: https://itsfoss.com/use-htop/
作者:[Sagar Sharma][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://itsfoss.com/author/sagar/
[b]: https://github.com/lkxed
[1]: https://itsfoss.com/linux-system-monitoring-tools/
[2]: https://linuxhandbook.com/top-command/
[3]: https://github.com/htop-dev/htop
[4]: https://itsfoss.com/wp-content/uploads/2022/11/install-and-use-htop.png
[5]: https://itsfoss.com/wp-content/uploads/2022/11/cpu-process-in-htop-1.png
[6]: https://itsfoss.com/wp-content/uploads/2022/11/memory-bar-in-htop.png
[7]: https://itsfoss.com/wp-content/uploads/2022/11/task-statistics-in-htop.png
[8]: https://itsfoss.com/wp-content/uploads/2022/11/sort-processes-in-htop-using-keyboard-shortcut.png
[9]: https://itsfoss.com/wp-content/uploads/2022/11/search-processes-in-htop.png
[10]: https://itsfoss.com/wp-content/uploads/2022/11/filter-processes-in-htop.png
[11]: https://itsfoss.com/wp-content/uploads/2022/11/kill-process-in-htop.png
[12]: https://linuxhandbook.com/termination-signals/
[13]: https://itsfoss.com/wp-content/uploads/2022/11/customize-htop-in-ubuntu.png
[14]: https://itsfoss.com/wp-content/uploads/2022/11/change-htop-colors-in-linux.png
[15]: https://itsfoss.com/wp-content/uploads/2022/11/explore-available-meters-in-htop.png
[16]: https://itsfoss.com/wp-content/uploads/2022/11/add-date-and-time-htop.png
[17]: https://linuxhandbook.com/man-pages/

View File

@ -1,201 +0,0 @@
[#]: subject: "A data scientist's guide to open source community analysis"
[#]: via: "https://opensource.com/article/22/12/data-scientists-guide-open-source-community-analysis"
[#]: author: "Cali Dolfi https://opensource.com/users/cdolfi"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
A data scientist's guide to open source community analysis
======
In the golden age of data analysis, open source communities are not exempt from the frenzy around getting some big, fancy numbers onto presentation slides. Such information can bring even more value if you master the art of generating a well-analyzed question with proper execution.
You might expect me, a [data scientist][1], to tell you that data analysis and automation will inform your community decisions. It's actually the opposite. Use data analysis to build on your existing open source community knowledge, incorporate others, and uncover potential biases and perspectives not considered. You might be an expert at implementing community events, while your colleague is a wiz at all things code. As each of you develops visualizations within the context of your own knowledge, you both can benefit from that information.
Let's have a moment of realness. Everyone has a thousand and one things to keep up with, and it feels like there is never enough time in a day to do so. If getting an answer about your community takes hours, you won't do it regularly (or ever). Spending the time to create a fully developed visualization makes it feasible to keep up with different aspects of the communities you care about.
With the ever-increasing pressure of being "data-driven," the treasure trove of information around open source communities can be a blessing and a curse. Using the methodology below, I will show you how to pick the needle out of the data haystack.
### What is your perspective?
When thinking about a metric, one of the first things you must consider is the perspective you want to provide. The following are a few concepts you could establish.
**Informative vs. influencing action:** Is there an area of your community that is not understood? Are you taking that first step in getting there? Are you trying to decide on a particular direction? Are you measuring an existing initiative?
**Exposing areas of improvement vs. highlighting strengths:** There are times when you are trying to hype up your community and show how great it is, especially when trying to demonstrate business impact or advocate for your project. When it comes to informing yourself and the community, you can often get the most value from your metrics by identifying shortcomings. Highlighting strengths is not a bad practice, but there is a time and place. Don't use metrics as a cheerleader inside your community to tell you how great everyone is; instead, share that with outsiders for recognition or promotion.
**Community and business impact:** Numbers and data are the languages of many businesses. That can make it incredibly difficult to advocate for your community and truly show its value. Data can be a way to speak in their language and show what they want to see to get the rest of your messaging across. Another perspective is the impact on open source overall. How does your community impact others and the ecosystem?
These are not always either/or perspectives. Proper framing will help in creating a more deliberate metric.
![Data science and machine learning workflow][2]
People often describe some version of this workflow when talking about general data science or machine learning work. I will focus on the first step, codifying problems and metrics, and briefly mention the second. From a data science perspective, this presentation can be considered a case study of this step. This step is sometimes overlooked, but your analysis's actual value starts here. You don't just wake up one day and know exactly what to look at. Begin with understanding what you want to know and what data you have to get you to the true goal of thoughtful execution of data analysis.
### 3 data analysis use cases in open source
Here are three different scenarios you might run into in your open source data analysis journey.
#### Scenario 1: Current data analysis
Suppose you are starting to go down the analysis path, and you already know what you're looking into is generally useful to you/your community. How can you improve? The idea here is to build off "traditional" open source community analysis. Suppose your data indicates you have had 120 total contributors over the project's lifetime. That's a value you can put on a slide, but you can't make decisions from it. Start taking incremental steps from just having a number to having insights. For example, you can break out the sample of total contributors into active versus drifting contributors (contributors who have not contributed in a set amount of time) from the same data.
#### Scenario 2: Community campaign impact measurement
![Goals and impacts][3]
Consider meetups, conferences, or any community outreach initiative. How do you view your impacts and goals? These two steps actually feed into each other. Once you establish the campaign goals, determine what can be measured to detect the effect. That information helps set the campaign's goals. It's easy to fall into the trap of being vague rather than concrete with plans when a campaign begins.
#### Scenario 3: Form new analysis areas to impact
![New analysis areas][4]
This situation occurs when you work from scratch in data analysis. The previous examples are different parts of this workflow. The workflow is a living cycle; you can always make improvements or extensions. From this concept, the following are the necessary steps you should work through. Later in this article, there will be three different examples of how this approach works in the real world.
#### Step 1: Break down focus areas and perspectives
First, consider a magic eight ball—the toy you can ask anything, shake, and get an answer. Think about your analysis area. If you could get any answer immediately, what would it be?
Next, think about the data. From your magic eight-ball question, what data sources could have anything to do with the question or focus area?
What questions could be answered in the data context to move you closer to your proposed magic eight-ball question? It's important to note that you must consider the assumptions made if you try to bring all the data together.
#### Step 2: Convert a question to a metric
Here is the process for each sub-question from the first step:
- Select the specific data points needed.
- Determine visualization to get the goal analysis.
- Hypothesize the impacts of this information.
Next, bring in the community to provide feedback and trigger an iterative development process. The collaborative portion of this can be where the real magic happens. The best ideas often come when bringing a concept to someone that inspires them in a way you or they would not have imagined.
#### Step 3: Analysis in action
This step is where you start working through the implications of the metric or visualization you have created.
The first thing to consider is if this metric follows what is currently known about the community.
- If **yes**: Are there assumptions made that catered to the results?
- If **no**: You want to investigate further whether this is potentially a data or calculation issue or if it is just a previously misunderstood part of the community.
Once you have determined if your analysis is stable enough to make inferences on, you can start to implement community initiatives on the information. As you are taking in the analysis to determine the next best step, you should identify specific ways to measure the initiative's success.
Now, observe these community initiatives informed by your metric. Determine if the impact is observable by your priorly established measurement of success. If not, consider the following:
- Are you measuring the right thing?
- Does the initiative strategy need to change?
### Example analysis area: New contributors
#### What is my magic eight-ball question?
- Do people have an experience that establishes them as consistent contributors?
#### What data do I have that goes into the analysis area and magic eight-ball question?
- What contributor activity exists for repos, including timestamps?
Now that you have the information and a magic eight-ball question, break the analysis down into subparts and follow each of them to the end. This idea correlates with steps 2 and 3 above.
**Sub-question 1:** "How are people coming into this project?"
This question aims to see what new contributors are doing first.
**Data:** GitHub data on first contributions over time (issues, PR, comments, etc.).
![Chart of first time contributions per quarter][5]
**Visualization:** Bar chart with first-time contributions broken down by quarter.
**Potential extension:** After you talk with other community members, further examination breaks the information down by quarter and whether the contributor was a repeat or drive-by. You can see what people are doing when they come in and if that tells you anything about whether they will stick around.
![Chart of drive-by contributions per quarter][6]
**Potential actions informed by this information:**
- Does the current documentation support contributors for the most common initial contribution? Could you support those contributors better, and would that help more of them stay?
- Is there a contribution area that is not common overall but is a good sign for a repeat contributor? Perhaps PR is a common area for repeat contributors, but most people don't work in that area.
**Action items:**
- Label "good first issues" consistently and link these issues to the contribution docs.
- Add a PR buddy to these.
**Sub-question 2:** "Is our code base really dependent on drive-by contributors?"
**Data:** Contribution data from GitHub.
![Chart of contributor types over time][7]
**Visualization:** "Total contributions: Broken down by contributions by drive-by and repeat contributor."
**Potential actions informed by this information:**
- Does this ratio achieve the program's goals? Is a lot of the work done by drive-by contributors? Is this an underutilized resource, and is the project not doing its part to bring them in?
### Analysis: Lessons learned
Number and data analysis are not "facts." They can say anything, and your internal skeptic should be very active when working with data. The iterative process is what will bring value. You don't want your analysis to be a "yes man." Take time to take a step back and evaluate the assumptions you've made.
If a metric just points you in a direction to investigate, that is a huge win. You can't look at or think of everything. Rabbit holes can be a good thing, and conversation starters can bring you to a new place.
Sometimes exactly what you want to measure is not there, but you might be able to get valuable details. You can't assume that you have all the puzzle pieces to get an exact answer to your original question. If you start to force an answer or solution, you can take yourself down a dangerous path led by assumptions. Leaving room for the direction or goal of analysis to change can lead you to a better place or insight than your original idea.
Data is a tool. It is not the answer, but it can bring together insights and information that would not have been accessible otherwise. The methodology of breaking down what you want to know into manageable chunks and building on that is the most important part.
Open source data analysis is a great example of the care you must take with all data science:
- The nuance of the topic area is the most important.
- The process of working through "what to ask/answer" is often overlooked.
- Knowing what to ask can be the hardest part, and when you come up with something insightful and innovative, it's much more than whatever tool you choose.
If you are a community member with no data science experience looking at where to start, I hope this information shows you how important and valuable you can be to this process. You bring the insights and perspectives of the community. If you are a data scientist or someone implementing the metrics or visualizations, you have to listen to the voices around you, even if you are also an active community member. More information on data science is listed at the end of this article.
### Wrap up
Use the above example as a framework for establishing data analysis of your own open source project. There are many questions to ask of your results, and knowing both the questions and their answers can lead your project in an exciting and fruitful direction.
#### More on data science
Consider the following sources for more information on data science and the technologies that provide it with data:
- [What is data science?][8]
- [What is Python?][9]
- [How to become a data scientist][10]
- [Data scientist: A day in the life][11]
- [What is big data?][12]
- [Whitepaper: Data-intensive intelligent applications in a hybrid cloud blueprint][13]
- [MariaDB and MySQL cheat sheet][14]
- [Latest data science articles][15]
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/12/data-scientists-guide-open-source-community-analysis
作者:[Cali Dolfi][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/cdolfi
[b]: https://github.com/lkxed
[1]: https://enterprisersproject.com/article/2022/9/data-scientist-day-life?intcmp=7013a000002qLH8AAM
[2]: https://opensource.com/sites/default/files/2022-11/datascience-machinelearning-workflow.jpg
[3]: https://opensource.com/sites/default/files/2022-11/goals-impact.png
[4]: https://opensource.com/sites/default/files/2022-11/new-analysis-areas.png
[5]: https://opensource.com/sites/default/files/2022-11/first-time-contributions-per-quarter.png
[6]: https://opensource.com/sites/default/files/2022-11/driveby-contributions-per-quarter.png
[7]: https://opensource.com/sites/default/files/2022-11/contributor-types-over-time.png
[8]: https://opensource.com/resources/data-science?intcmp=7013a000002CxqkAAC
[9]: https://opensource.com/resources/python?intcmp=7013a000002CxqkAAC
[10]: https://opensource.com/article/17/9/data-scientist?intcmp=7013a000002CxqkAAC
[11]: https://enterprisersproject.com/article/2022/9/data-scientist-day-life?intcmp=7013a000002CxqkAAC
[12]: https://opensource.com/resources/big-data?intcmp=7013a000002CxqkAAC
[13]: https://www.redhat.com/en/resources/data-intensive-applications-hybrid-cloud-blueprint-detail?intcmp=7013a000002CxqkAAC
[14]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet?intcmp=7013a000002CxqkAAC
[15]: https://opensource.com/tags/data-science?intcmp=7013a000002CxqkAAC

View File

@ -1,260 +0,0 @@
[#]: subject: "How I use my old camera as a webcam with Linux"
[#]: via: "https://opensource.com/article/22/12/old-camera-webcam-linux"
[#]: author: "Tom Oliver https://opensource.com/users/tomoliver"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How I use my old camera as a webcam with Linux
======
This year after largely abandoning my MacBook in favor of a NixOS machine, I started getting requests to "turn my camera on" when video calling people. This was a problem because I didn't have a webcam. I thought about buying one, but then I realized I had a perfectly good Canon EOS Rebel XS DSLR from 2008 lying around on my shelf. This camera has a mini-USB port, so naturally, I pondered: Did a DSLR, mini-USB port, and a desktop PC mean I could have a webcam?
There's just one problem. My Canon EOS Rebel XS isn't capable of recording video. It can take some nice pictures, but that's about it. So that's the end of that.
Or is it?
There happens to be some amazing open source software called [gphoto2][1]. Once installed, it allows you to control various supported cameras from your computer and it takes photos and videos.
### Supported cameras
First, find out whether yours is supported:
```
$ gphoto2 --list-cameras
```
### Capture an image
You can take a picture with it:
```
$ gphoto2 --capture-image-and-download
```
The shutter activates, and the image is saved to your current working directory.
### Capture video
I sensed the potential here, so despite the aforementioned lack of video functionality on my camera, I decided to try `gphoto2 --capture-movie`. Somehow, although my camera does not support video natively, gphoto2 still manages to spit out an MJPEG file!
On my camera, I need to put it in "live-view" mode before gphoto2 records video. This consists of setting the camera to portrait mode and then pressing the **Set** button so that the viewfinder is off and the camera screen displays an image. Unfortunately, though, this isn't enough to be able to use it as a webcam. It still needs to get assigned a video device, such as `/dev/video0`.
### Install ffmpeg and v4l2loopback
Not surprisingly, there's an open source solution to this problem. First, use your package manager to install `gphoto2`, `ffmpeg`, and `mpv`. For example, on Fedora, CentOS, Mageia, and similar:
```
$ sudo dnf install gphoto2 ffmpeg mpv
```
On Debian, Linux Mint, and similar:
```
$ sudo apt install gphoto2 ffmpeg mpv
```
I use NixOS, so here's my configuration:
```
# configuration.nix
...
environment.systemPackages = with pkgs; [
  ffmpeg
  gphoto2
  mpv
...
```
Creating a virtual video device requires the `v4l2loopback` Linux kernel module. At the time of this writing, that capability is not included in the mainline kernel, so you must download and compile it yourself:
```
$ git clone https://github.com/umlaeute/v4l2loopback
$ cd v4l2loopback
$ make
$ sudo make install
$ sudo depmod -a
```
If you're using NixOS like me, you can just add the extra module package in `configuration.nix`:
```
[...]
boot.extraModulePackages = with config.boot.kernelPackages;
[ v4l2loopback.out ];
boot.kernelModules = [
  "v4l2loopback"
];
boot.extraModprobeConfig = ''
  options v4l2loopback exclusive_caps=1 card_label="Virtual Camera"
'';
[...]
```
On NixOS, run `sudo nixos-rebuild switch` and then reboot.
### Create a video device
Assuming your computer currently has no `/dev/video` device, you can create one on demand thanks to the `v4l2loopback`.
Run this command to send data from `gphoto2` to `ffmpeg`, using a device such as `/dev/video0` device:
```
$ gphoto2 --stdout --capture-movie |
 ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
```
You get output like this:
```
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.3.0 (GCC)
  configuration: --disable-static ...
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Capturing preview frames as movie to 'stdout'. Press Ctrl-C to abort.[mjpeg @ 0x1dd0380] Format mjpeg detected only with low score of 25, misdetection possible!
Input #0, mjpeg, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 768x512 ...
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native))[swscaler @ 0x1e27340] deprecated pixel format used, make sure you did set range correctly
Output #0, video4linux2,v4l2, to '/dev/video0':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: rawvideo (I420 / 0x30323449) ...
    Metadata:
      encoder         : Lavc58.134.100 rawvideoframe=  289 fps= 23 q=-0.0 size=N/A time=00:00:11.56 bitrate=N/A speed=0.907x
```
To see the video feed from your webcam, use `mpv`:
```
$ mpv av://v4l2:/dev/video0 --profile=low-latency --untimed
```
![Streaming a live feed from the webcam][2]
### Start your webcam automatically
It's a bit annoying to execute a command every time you want to use your webcam. Luckily, you can run this command automatically at startup. I implement it as a `systemd` service:
```
# configuration.nix
...
  systemd.services.webcam = {
    enable = true;
    script = ''
      ${pkgs.gphoto2}/bin/gphoto2 --stdout --capture-movie |
        ${pkgs.ffmpeg}/bin/ffmpeg -i - \
            -vcodec rawvideo -pix_fmt yuv420p -f v4l2  /dev/video0
    '';
wantedBy = [ "multi-user.target" ];
  };
...
```
On NixOS, run `sudo nixos-rebuild switch` and then reboot your computer. Your webcam is on and active.
To check for any problems, you can use `systemctl status webcam`. This tells you the last time the service was run and provides a log of its previous output. It's useful for debugging.
### Iterating to make it better
It's tempting to stop here. However, considering the current global crises, it may be pertinent to wonder whether it's necessary to have a webcam on all the time. It strikes me as sub-optimal for two reasons:
- It's a waste of electricity.
- There are privacy concerns associated with this kind of thing.
My camera has a lens cap, so to be honest, the second point doesn't really bother me. I can always put the lens cap on when I'm not using the webcam. However, leaving a big power-hungry DSLR camera on all day (not to mention the CPU overhead required for decoding the video) isn't doing anything for my electricity bill.
The ideal scenario:
- I leave my camera plugged in to my computer all the time but switched off.
- When I want to use the webcam, I switch on the camera with its power button.
- My computer detects the camera and starts the systemd service.
- After finishing with the webcam, I switch it off again.
To achieve this, you need to use a custom [udev rule][3].
A udev rule tells your computer to perform a certain task when it discovers that a device has become available. This could be an external hard drive or even a non-USB device. In this case, you need it to [recognize the camera through its USB connection][4].
First, specify what command to run when the udev rule is triggered. You can do that as a shell script (`systemctl restart webcam` should work). I run NixOS, so I just create a derivation (a Nix package) that restarts the systemd service:
```
# start-webcam.nix
with import <nixpkgs> { };
writeShellScriptBin "start-webcam" ''
  systemctl restart webcam
  # debugging example
  # echo "hello" &> /home/tom/myfile.txt
  # If myfile.txt gets created then we know the udev rule has triggered properly''
```
Next, actually define the udev rule. Find the device and vendor ID of the camera. Do this by using the `lsusb` command. That command is likely already installed on your distribution, but I don't use it often, so I just install it as needed using `nix-shell`:
```
$ nix-shell -p usbutils
```
Whether you already have it on your computer or you've just installed it, run `lsusb`:
```
$ lsusb
Bus 002 Device 008: ID 04a9:317b Canon, Inc. Canon Digital Camera[...]
```
In this output, the vendor ID is 04a9 and the device ID is 317b. That's enough to create the udev rule:
```
ACTION=="add", SUBSYSTEM=="usb",
ATTR{idVendor}=="04a9",
ATTR{idProduct}=="317b",
RUN+="/usr/local/bin/start-webcam.sh"
```
Alternatively, if you're using NixOS:
```
# configuration.nix[...]let
  startWebcam = import ./start-webcam.nix;[...]
services.udev.extraRules = ''
  ACTION=="add",  \
  SUBSYSTEM=="usb", \
  ATTR{idVendor}=="04a9", \
  ATTR{idProduct}=="317b",  \
  RUN+="${startWebcam}/bin/start-webcam"'';[...]
```
Finally, remove the **wantedBy = ["multi-user.target"];** line in your `start-webcam` systemd service. (If you leave it, then the service starts automatically when you next reboot, whether the camera is switched on or not.)
### Reuse old technology
I hope this article has made you think twice before chucking some of your old tech. Linux can breathe life back into technology, whether it's your [computer][5] or something simple like a digital camera or some other peripheral.
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/12/old-camera-webcam-linux
作者:[Tom Oliver][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/tomoliver
[b]: https://github.com/lkxed
[1]: https://opensource.com/article/20/7/gphoto2-linux
[2]: https://opensource.com/sites/default/files/2022-12/streaming-webcam.png
[3]: https://opensource.com/article/18/11/udev
[4]: https://opensource.com/article/22/1/cameras-usb-ports-obs
[5]: https://opensource.com/article/22/4/how-linux-saves-earth

View File

@ -0,0 +1,415 @@
[#]: subject: "Examples of floating point problems"
[#]: via: "https://jvns.ca/blog/2023/01/13/examples-of-floating-point-problems/"
[#]: author: "Julia Evans https://jvns.ca/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Examples of floating point problems
======
Hello! Ive been thinking about writing a zine about how things are represented on computers in bytes, so I was thinking about floating point.
Ive heard a million times about the dangers of floating point arithmetic, like:
- addition isnt associative (`x + (y + z)` is different from `(x + y) + z`)
- if you add very big values to very small values, you can get inaccurate results (the small numbers get lost!)
- you cant represent very large integers as floating numbers
- NaN/infinity values can propagate and cause chaos
- there are two zeros (+0 and -0), and theyre not represented the same way
- denormal/subnormal values are weird
But I find all of this a little abstract on its own, and I really wanted some
specific examples of floating point bugs in real-world programs.
So I [asked on Mastodon][1] for
examples of how floating point has gone wrong for them in real programs, and as
always folks delivered! Here are a bunch of examples. Ive also written some
example programs for some of them to see exactly what happens. Heres a table of contents:
[how does floating point work?][2][floating point isnt “bad” or random][3][example 1: the odometer that stopped][4][example 2: tweet IDs in Javascript][5][example 3: a variance calculation gone wrong][6][example 4: different languages sometimes do the same floating point calculation differently][7][example 5: the deep space kraken][8][example 6: the inaccurate timestamp][9][example 7: splitting a page into columns][10][example 8: collision checking][11]
None of these 8 examples talk about NaNs or +0/-0 or infinity values or
subnormals, but its not because those things dont cause problems its just
that I got tired of writing at some point :).
Also Ive probably made some mistakes in this post.
#### how does floating point work?
Im not going to write a long explanation of how floating point works in this post, but heres a comic I wrote a few years ago that talks about the basics:
![][12]
#### floating point isnt “bad” or random
I dont want you to read this post and conclude that floating point is bad.
Its an amazing tool for doing numerical calculations. So many smart people
have done so much work to make numerical calculations on computers efficient and
accurate! Two points about how all of this isnt floating points fault:
- Doing numerical computations on a computer inherently involves
some approximation and rounding, especially if you want to do it
efficiently. You cant always store an arbitrary amount of precision for
every single number youre working with.
- Floating point is standardized (IEEE 754), so operations like addition on
floating point numbers are deterministic my understanding is that 0.1 +
0.2 will always give you the exact same result (0.30000000000000004), even
across different architectures. It might not be the result you _expected_,
but its actually very predictable.
My goal for this post is just to explain what kind of problems can come up with
floating point numbers and why they happen so that you know when to be
careful with them, and when theyre not appropriate.
Now lets get into the examples.
#### example 1: the odometer that stopped
One person said that they were working on an odometer that was continuously
adding small amounts to a 32-bit float to measure distance travelled, and
things went very wrong.
To make this concrete, lets say that were adding numbers to the odometer 1cm
at a time. What does it look like after 10,000 kilometers?
Heres a C program that simulates that:
```
#include <stdio.h>
int main() {
float meters = 0;
int iterations = 100000000;
for (int i = 0; i < iterations; i++) {
meters += 0.01;
}
printf("Expected: %f km\n", 0.01 * iterations / 1000 );
printf("Got: %f km \n", meters / 1000);
}
```
and heres the output:
```
Expected: 10000.000000 km
Got: 262.144012 km
```
This is VERY bad its not a small error, 262km is a LOT less than 10,000km. What went wrong?
#### what went wrong: gaps between floating point numbers get big
The problem in this case is that, for 32-bit floats, 262144.0 + 0.01 = 262144.0.
So its not just that the number is inaccurate, itll actually never increase
at all! If we travelled another 10,000 kilometers, the odometer would still be
stuck at 262144 meters (aka 262.144km).
Why is this happening? Well, floating point numbers get farther apart as they get bigger. In this example, for 32-bit floats, here are 3 consecutive floating point numbers:
- 262144.0
- 262144.03125
- 262144.0625
I got those numbers by going to [https://float.exposed/0x48800000][13] and incrementing the significand number a couple of times.
So, there are no 32-bit floating point numbers between 262144.0 and 262144.03125. Why is that a problem?
The problem is that 262144.03125 is about 262144.0 + 0.03. So when we try to
add 0.01 to 262144.0, it doesnt make sense to round up to the next number. So
the sum just stays at 262144.0.
Also, its not a coincidence that 262144 is a power of 2 (its 2^18). The gaps
been floating point numbers change after every power of 2, and at 2^18 the gap
between 32-bit floats is 0.03125, increasing from 0.016ish.
#### one way to solve this: use a double
Using a 64-bit float fixes this if we replace `float` with `double` in the above C program, everything works a lot better. Heres the output:
```
Expected: 10000.000000 km
Got: 9999.999825 km
```
There are still some small inaccuracies here were off about 17 centimeters.
Whether this matters or not depends on the context: being slightly off could very
well be disastrous if we were doing a precision space maneuver or something, but
its probably fine for an odometer.
Another way to improve this would be to increment the odometer in bigger chunks
instead of adding 1cm at a time, maybe we could update it less frequently,
like every 50cm.
If we use a double **and** increment by 50cm instead of 1cm, we get the exact
correct answer:
```
Expected: 10000.000000 km
Got: 10000.000000 km
```
A third way to solve this could be to use an **integer**: maybe we decide that
the smallest unit we care about is 0.1mm, and then measure everything as
integer multiples of 0.1mm. I have never built an odometer so I cant say what
the best approach is.
#### example 2: tweet IDs in Javascript
Javascript only has floating point numbers it doesnt have an integer type.
The biggest integer you can represent in a 64-bit floating point number is
2^53.
But tweet IDs are big numbers, bigger than 2^53. The Twitter API now returns
them as both integers and strings, so that in Javascript you can just use the
string ID (like “1612850010110005250”), but if you tried to use the integer
version in JS, things would go very wrong.
You can check this yourself by taking a tweet ID and putting it in the
Javascript console, like this:
```
>> 1612850010110005250
1612850010110005200
```
Notice that 1612850010110005200 is NOT the same number as 1612850010110005250!! Its 50 less!
This particular issue doesnt happen in Python (or any other language that I
know of), because Python has integers. Heres what happens if we enter the same number in a Python REPL:
```
In [3]: 1612850010110005250
Out[3]: 1612850010110005250
```
Same number, as youd expect.
#### example 2.1: the corrupted JSON data
This is a small variant of the “tweet IDs in Javascript” issue, but even if
youre _not_ actually writing Javascript code, numbers in JSON are still sometimes
treated as if theyre floats. This mostly makes sense to me because JSON has
“Javascript” in the name, so it seems reasonable to decode the values the way
Javascript would.
For example, if we pass some JSON through `jq`, we see the exact same issue:
the number 1612850010110005250 gets changed into 1612850010110005200.
```
$ echo '{"id": 1612850010110005250}' | jq '.'
{
"id": 1612850010110005200
}
```
But its not consistent across all JSON libraries Pythons `json` module will decode `1612850010110005250` as the correct integer.
Several people mentioned issues with sending floats in JSON, whether either
they were trying to send a large integer (like a pointer address) in JSON and
it got corrupted, or sending smaller floating point values back and forth
repeatedly and the value slowly diverging over time.
#### example 3: a variance calculation gone wrong
Lets say youre doing some statistics, and you want to calculate the variance
of many numbers. Maybe more numbers than you can easily fit in memory, so you
want to do it in a single pass.
Theres a simple (but bad!!!) algorithm you can use to calculate the variance in a single pass,
from [this blog post][14]. Heres some Python code:
```
def calculate_bad_variance(nums):
sum_of_squares = 0
sum_of_nums = 0
N = len(nums)
for num in nums:
sum_of_squares += num**2
sum_of_nums += num
mean = sum_of_nums / N
variance = (sum_of_squares - N * mean**2) / N
print(f"Real variance: {np.var(nums)}")
print(f"Bad variance: {variance}")
```
First, lets use this bad algorithm to calculate the variance of 5 small numbers. Everything looks pretty good:
```
In [2]: calculate_bad_variance([2, 7, 3, 12, 9])
Real variance: 13.84
Bad variance: 13.840000000000003 <- pretty close!
```
Now, lets try it the same 100,000 large numbers that are very close together (distributed between 100000000 and 100000000.06)
```
In [7]: calculate_bad_variance(np.random.uniform(100000000, 100000000.06, 100000))
Real variance: 0.00029959105209321173
Bad variance: -138.93632 <- OH NO
```
This is extremely bad: not only is the bad variance way off, its NEGATIVE! (the variance is never supposed to be negative, its always zero or more)
#### what went wrong: catastrophic cancellation
Whats going here is similar to our odometer number problem: the
`sum_of_squares` number gets extremely big (about 10^21 or 2^69), and at that point, the
gap between consecutive floating point numbers is also very big its 2**46.
So we just lose all precision in our calculations.
The term for this problem is “catastrophic cancellation” were subtracting
two very large floating point numbers which are both going to be pretty far
from the correct value of the calculation, so the result of the subtraction is
also going to be wrong.
[The blog post I mentioned before][14]
talks about a better algorithm people use to compute variance called
Welfords algorithm, which doesnt have the catastrophic cancellation issue.
And of course, the solution for most people is to just use a scientific
computing library like Numpy to calculate variance instead of trying to do it
yourself :)
#### example 4: different languages sometimes do the same floating point calculation differently
A bunch of people mentioned that different platforms will do the same
calculation in different ways. One way this shows up in practice is maybe
you have some frontend code and some backend code that do the exact same
floating point calculation. But its done slightly differently in Javascript
and in PHP, so you users end up seeing discrepancies and getting confused.
In principle you might think that different implementations should work the
same way because of the IEEE 754 standard for floating point, but here are a
couple of caveats that were mentioned:
- math operations in libc (like sin/log) behave differently in different
implementations. So code using glibc could give you different results than
code using musl
- some x86 instructions can use 80 bit precision for some double operations
internally instead of 64 bit precision. [Heres a GitHub issue talking about
that][15]
Im not very sure about these points and I dont have concrete examples I can reproduce.
#### example 5: the deep space kraken
Kerbal Space Program is a space simulation game, and it used to have a bug
called the [Deep Space Kraken][16] where when
you moved very fast, your ship would start getting destroyed due to floating point issues. This is similar to the other problems weve talked out involving big floating numbers (like the variance problem), but I wanted to mention it because:
- it has a funny name
- it seems like a very common bug in video games / astrophysics / simulations in general if you have points that are very far from the origin, your math gets messed up
Another example of this is the [Far Lands][17] in Minecraft.
#### example 6: the inaccurate timestamp
I promise this is the last example of “very large floating numbers can ruin your day”.
But! Just one more! Lets imagine that we try to represent the current Unix epoch in nanoseconds
(about 1673580409000000000) as a 64-bit floating point number.
This is no good! 1673580409000000000 is about 2^60 (crucially, bigger than 2^53), and the next 64-bit float after it is 1673580409000000256.
So this would be a great way to end up with inaccuracies in your time math. Of
course, time libraries actually represent times as integers, so this isnt
usually a problem. (theres always still the [year 2038 problem][18], but thats not
related to floats)
In general, the lesson here is that sometimes its better to use integers.
#### example 7: splitting a page into columns
Now that weve talked about problems with big floating point numbers, lets do
a problem with small floating point numbers.
Lets say you have a page width, and a column width, and you want to figure out:
- how many columns fit on the page
- how much space is left over
You might reasonably try `floor(page_width / column_width)` for the first
question and `page_width % column_width` for the second question. Because
that would work just fine with integers!
```
In [5]: math.floor(13.716 / 4.572)
Out[5]: 3
In [6]: 13.716 % 4.572
Out[6]: 4.571999999999999
```
This is wrong! The amount of space left is 0!
A better way to calculate the amount of space left might have been
`13.716 - 3 * 4.572`, which gives us a very small negative number.
I think the lesson here is to never calculate the same thing in 2 different ways with floats.
This is a very basic example but I can kind of see how this would create all
kinds of problems if I was doing page layout with floating point numbers, or
doing CAD drawings.
#### example 8: collision checking
Heres a very silly Python program, that starts a variable at 1000 and
decrements it until it collides with 0. You can imagine that this is part of a
pong game or something, and that `a` is a ball thats supposed to collide with
a wall.
```
a = 1000
while a != 0:
a -= 0.001
```
You might expect this program to terminate. But it doesnt! `a` is never 0,
instead it goes from 1.673494676862619e-08 to -0.0009999832650532314.
The lesson here is that instead of checking for float equality, usually you
want to check if two numbers are different by some very small amount. Or here
we could just write `while a > 0`.
#### thats all for now
I didnt even get to NaNs (the are so many of them!) or infinity or +0 / -0 or subnormals, but weve
already written 2000 words and Im going to just publish this.
I might write another followup post later that Mastodon thread has literally
15,000 words of floating point problems in it, theres a lot of material! Or I
might not, who knows :)
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2023/01/13/examples-of-floating-point-problems/
作者:[Julia Evans][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://jvns.ca/
[b]: https://github.com/lkxed/
[1]: https://mastodon.social/@b0rk/109670855322107281
[2]: https://jvns.ca#how-does-floating-point-work
[3]: https://jvns.ca#floating-point-isn-t-bad-or-random
[4]: https://jvns.ca#example-1-the-odometer-that-stopped
[5]: https://jvns.ca#example-2-tweet-ids-in-javascript
[6]: https://jvns.ca#example-3-a-variance-calculation-gone-wrong
[7]: https://jvns.ca#example-4-different-languages-sometimes-do-the-same-floating-point-calculation-differently
[8]: https://jvns.ca#example-5-the-deep-space-kraken
[9]: https://jvns.ca#example-6-the-inaccurate-timestamp
[10]: https://jvns.ca#example-7-splitting-a-page-into-columns
[11]: https://jvns.ca#example-8-collision-checking
[12]: https://wizardzines.com/comics/floating-point/floating-point.png
[13]: https://float.exposed/0x48800000
[14]: https://jonisalonen.com/2013/deriving-welfords-method-for-computing-variance/
[15]: https://github.com/microsoft/WSL/issues/830
[16]: https://wiki.kerbalspaceprogram.com/wiki/Deep_Space_Kraken
[17]: https://minecraftbedrock-archive.fandom.com/wiki/Far_Lands
[18]: https://en.wikipedia.org/wiki/Year_2038_problem

View File

@ -0,0 +1,472 @@
[#]: subject: "Examples of problems with integers"
[#]: via: "https://jvns.ca/blog/2023/01/18/examples-of-problems-with-integers/"
[#]: author: "Julia Evans https://jvns.ca/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Examples of problems with integers
======
Hello! A few days back we talked about [problems with floating point numbers][1].
This got me thinking but what about integers? Of course integers have all
kinds of problems too anytime you represent a number in a small fixed amount of
space (like 8/16/32/64 bits), youre going to run into problems.
So I [asked on Mastodon again][2] for examples of integer problems and got all kinds of great responses again. Heres a table of contents.
[example 1: the small database primary key][3][example 2: integer overflow/underflow][4][aside: how do computers represent negative integers?][5][example 3: decoding a binary format in Java][6][example 4: misinterpreting an IP address or string as an integer][7][example 5: security problems because of integer overflow][8][example 6: the case of the mystery byte order][9][example 7: modulo of negative numbers][10][example 8: compilers removing integer overflow checks][11][example 9: the && typo][12]
Like last time, Ive written some example programs to demonstrate these
problems. Ive tried to use a variety of languages in the examples (Go,
Javascript, Java, and C) to show that these problems dont just show up in
super low level C programs integers are everywhere!
Also Ive probably made some mistakes in here, I learned several things while writing this.
#### example 1: the small database primary key
One of the most classic (and most painful!) integer problems is:
- You create a database table where the primary key is a 32-bit unsigned integer, thinking “4 billion rows should be enough for anyone!”
- You are massively successful and eventually, your table gets close to 4 billion rows
- oh no!
- You need to do a database migration to switch your primary key to be a 64-bit integer instead
If the primary key actually reaches its maximum value Im not sure exactly what
happens, Id imagine you wouldnt be able to create any new database rows and
it would be a very bad day for your massively successful service.
#### example 2: integer overflow/underflow
Heres a Go program:
```
package main
import "fmt"
func main() {
var x uint32 = 5
var length uint32 = 0
if x < length-1 {
fmt.Printf("%d is less than %d\n", x, length-1)
}
}
```
This slightly mysteriously prints out:
```
5 is less than 4294967295
```
That true, but its not what you might have expected.
#### whats going on?
`0 - 1` is equal to the 4 bytes `0xFFFFFFFF`.
There are 2 ways to interpret those 4 bytes:
- As a _signed_ integer (-1)
- As an _unsigned_ integer (4294967295)
Go here is treating `length - 1` as a **unsigned** integer, because we defined `x` and `length` as uint32s (the “u” is for “unsigned”). So its testing if 5 is less than 4294967295, which it is!
#### what do we do about it?
Im not actually sure if theres any way to automatically detect integer overflow errors in Go. (though it looks like theres a [github issue from 2019 with some discussion][13])
Some brief notes about other languages:
- Lots of languages (Python, Java, Ruby) dont have unsigned integers at all, so this specific problem doesnt come up
- In C, you can compile with `clang -fsanitize=unsigned-integer-overflow`. Then if your code has an overflow/underflow like this, the program will crash.
- Similarly in Rust, if you compile your program in debug mode itll crash if theres an integer overflow. But in release mode it wont crash, itll just happily decide that 0 - 1 = 4294967295.
The reason Rust doesnt check for overflows if you compile your program in
release mode (and the reason C and Go dont check) is that these checks are
expensive! Integer arithmetic is a very big part of many computations, and
making sure that every single addition isnt overflowing makes it slower.
#### aside: how do computers represent negative integers?
I mentioned in the last section that `0xFFFFFFFF` can mean either `-1` or
`4294967295`. You might be thinking what??? Why would `0xFFFFFFFF` mean `-1`?
So lets talk about how computers represent negative integers for a second.
Im going to simplify and talk about 8-bit integers instead of 32-bit integers,
because there are less of them and it works basically the same way.
You can represent 256 different numbers with an 8-bit integer: 0 to 255
```
00000000 -> 0
00000001 -> 1
00000010 -> 2
...
11111111 -> 255
```
But what if you want to represent _negative_ integers? We still only have 8
bits! So we need to reassign some of these and treat them as negative numbers
instead.
Heres the way most modern computers do it:
- Every number thats 128 or more becomes a negative number instead
- How to know _which_ negative number it is: take the positive integer youd expect it to be, and then subtract 256
So 255 becomes -1, 128 becomes -128, and 200 becomes -56.
Here are some maps of bits to numbers:
```
00000000 -> 0
00000001 -> 1
00000010 -> 2
01111111 -> 127
10000000 -> -128 (previously 128)
10000001 -> -127 (previously 129)
10000010 -> -126 (previously 130)
...
11111111 -> -1 (previously 255)
```
This gives us 256 numbers, from -128 to 127.
And `11111111` (or `0xFF`, or 255) is -1.
For 32 bit integers, its the same story, except its “every number larger than 2^31 becomes negative” and “subtract 2^32”. And similarly for other integer sizes.
Thats how we end up with `0xFFFFFFFF` meaning -1.
#### there are multiple ways to represent negative integers
The way we just talked about of representing negative integers (“its the equivalent positive integer, but you subtract 2^n”) is called
**twos complement**, and its the most common on modern computers. There are several other ways
though, the [wikipedia article has a list][14].
#### weird thing: the absolute value of -128 is negative
This [Go program][15] has a pretty simple `abs()` function that computes the absolute value of an integer:
```
package main
import (
"fmt"
)
func abs(x int8) int8 {
if x < 0 {
return -x
}
return x
}
func main() {
fmt.Println(abs(-127))
fmt.Println(abs(-128))
}
```
This prints out:
```
127
-128
```
This is because the signed 8-bit integers go from -128 to 127 there **is** no +128!
Some programs might crash when you try to do this (its an overflow), but Go
doesnt.
Now that weve talked about signed integers a bunch, lets dig into another example of how they can cause problems.
#### example 3: decoding a binary format in Java
Lets say youre parsing a binary format in Java, and you want to get the first
4 bits of the byte `0x90`. The correct answer is 9.
```
public class Main {
public static void main(String[] args) {
byte b = (byte) 0x90;
System.out.println(b >> 4);
}
}
```
This prints out “-7”. Thats not right!
#### whats going on?
There are two things we need to know about Java to make sense of this:
- Java doesnt have unsigned integers.
- Java cant right shift bytes, it can only shift integers. So anytime you shift a byte, it has to be promoted into an integer.
Lets break down what those two facts mean for our little calculation `b >> 4`:
- In bits, `0x90` is `10010000`. This starts with a 1, which means that its more than 128, which means its a negative number
- Java sees the `>>` and decides to promote `0x90` to an integer, so that it can shift it
- The way you convert a negative byte to an 32-bit integer is to add a bunch of `1`s at the beginning. So now our 32-bit integer is `0xFFFFFF90` (`F` being 15, or `1111`)
- Now we right shift (`b >> 4`). By default, Java does a **signed shift**, which means that it adds 0s to the beginning if its positive, and 1s to the beginning if its negative. (`>>>` is an unsigned shift in Java)
- We end up with `0xFFFFFFF9` (having cut off the last 4 bits and added more 1s at the beginning)
- As a signed integer, thats -7!
#### what can you do about it?
I dont the actual idiomatic way to do this in Java is, but the way Id naively
approach fixing this is to put in a bit mask before doing the right shift. So
instead of:
```
b >> 4
```
wed write
```
(b & 0xFF) >> 4
```
`b & 0xFF` seems redundant (`b` is already a byte!), but its actually not because `b` is being promoted to an integer.
Now instead of `0x90 -> 0xFFFFFF90 -> 0xFFFFFFF9`, we end up calculating `0x90 -> 0xFFFFFF90 -> 0x00000090 -> 0x00000009`, which is the result we wanted: 9.
And when we actually try it, it prints out “9”.
Also, if we were using a language with unsigned integers, the natural way to
deal with this would be to treat the value as an unsigned integer in the first
place. But thats not possible in Java.
#### example 4: misinterpreting an IP address or string as an integer
I dont know if this is technically a “problem with integers” but its funny
so Ill mention it: [Rachel by the bay][16] has a bunch of great
examples of things that are not integers being interpreted as integers. For
example, “HTTP” is `0x48545450` and `2130706433` is `127.0.0.1`.
She points out that you can actually ping any integer, and itll convert that integer into an IP address, for example:
```
$ ping 2130706433
PING 2130706433 (127.0.0.1): 56 data bytes
$ ping 132848123841239999988888888888234234234234234234
PING 132848123841239999988888888888234234234234234234 (251.164.101.122): 56 data bytes
```
(Im not actually sure how ping is parsing that second integer or why ping accepts these giant larger-than-2^64-integers as valid inputs, but its a fun weird thing)
#### example 5: security problems because of integer overflow
Another integer overflow example: heres a [search for CVEs involving integer overflows][17].
There are a lot! Im not a security person, but heres one random example: this [json parsing library bug][18]
My understanding of that json parsing bug is roughly:
- you load a JSON file thats 3GB or something, or 3,000,000,000
- due to an integer overflow, the code allocates close to 0 bytes of memory instead of ~3GB amount of memory
- but the JSON file is still 3GB, so it gets copied into the tiny buffer with almost 0 bytes of memory
- this overwrites all kinds of other memory that its not supposed to
The CVE says “This vulnerability mostly impacts process availability”, which I
think means “the program crashes”, but sometimes this kind of thing is much
worse and can result in arbitrary code execution.
My impression is that there are a large variety of different flavours of
security vulnerabilities caused by integer overflows.
#### example 6: the case of the mystery byte order
One person said that theyre do scientific computing and sometimes they need to
read files which contain data with an unknown byte order.
Lets invent a small example of this: say youre reading a file which contains 4
bytes - `00`, `00`, `12`, and `81` (in that order), that you happen to know
represent a 4-byte integer. There are 2 ways to interpret that integer:
- `0x00001281` (which translates to 4737). This order is called “big endian”
- `0x81120000` (which translates to 2165440512). This order is called “little endian”.
Which one is it? Well, maybe the file contains some metadata that specifies the
endianness. Or maybe you happen to know what machine it was generated on and
what byte order that machine uses. Or maybe you just read a bunch of values,
try both orders, and figure out which makes more sense. Maybe 2165440512 is too
big to make sense in the context of whatever your data is supposed to mean, or
maybe `4737` is too small.
A couple more notes on this:
- this isnt just a problem with integers, floating point numbers have byte
order too
- this also comes up when reading data from a network, but in that case the
byte order isnt a “mystery”, its just going to be big endian. But x86
machines (and many others) are little endian, so you have to swap the byte
order of all your numbers.
#### example 7: modulo of negative numbers
This is more of a design decision about how different programming languages design their math libraries, but its still a little weird and lots of people mentioned it.
Lets say you write `-13 % 3` in your program, or `13 % -3`. Whats the result?
It turns out that different programming languages do it differently, for
example in Python `-13 % 3 = 2` but in Javascript `-13 % 3 = -1`.
Theres a table in [this blog post][19] that
describes a bunch of different programming languages choices.
#### example 8: compilers removing integer overflow checks
Weve been hearing a lot about integer overflow and why its bad. So lets
imagine you try to be safe and include some checks in your programs after
each addition, you make sure that the calculation didnt overflow. Like this:
```
#include <stdio.h>
#define INT_MAX 2147483647
int check_overflow(int n) {
n = n + 100;
if (n + 100 < 0)
return -1;
return 0;
}
int main() {
int result = check_overflow(INT_MAX);
printf("%d\n", result);
}
```
`check_overflow` here should return `-1` (failure), because `INT_MAX + 100` is more than the maximum integer size.
```
$ gcc check_overflow.c -o check_overflow && ./check_overflow
-1
$ gcc -O3 check_overflow.c -o check_overflow && ./check_overflow
0
```
Thats weird when we compile with `gcc`, we get the answer we expected, but
with `gcc -O3`, we get a different answer. Why?
#### whats going on?
My understanding (which might be wrong) is:
- Signed integer overflow in C is **undefined behavior**. I think thats
because different C implementations might be using different representations
of signed integers (maybe theyre using ones complement instead of twos
complement or something)
- “undefined behaviour” in C means “the compiler is free to do literally whatever it wants after that point” (see this post [With undefined behaviour, anything is possible][20] by Raph Levine for a lot more)
- Some compiler optimizations assume that undefined behaviour will never
happen. Theyre free to do this, because if that undefined behaviour
_did_ happen, then theyre allowed to do whatever they want, so “run the
code that I optimized assuming that this would never happen” is fine.
- So this `if (n + 100 < 0)` check is irrelevant if that did
happen, it would be undefined behaviour, so theres no need to execute the
contents of that if statement.
So, thats weird. Im not going to write a “what can you do about it?” section here because Im pretty out of my depth already.
I certainly would not have expected that though.
My impression is that “undefined behaviour” is really a C/C++ concept, and
doesnt exist in other languages in the same way except in the case of “your
program called some C code in an incorrect way and that C code did something
weird because of undefined behaviour”. Which of course happens all the time.
#### example 9: the && typo
This one was mentioned as a very upsetting bug. Lets say you have two integers
and you want to check that theyre both nonzero.
In Javascript, you might write:
```
if a && b {
/* some code */
}
```
But you could also make a typo and type:
```
if a & b {
/* some code */
}
```
This is still perfectly valid code, but it means something completely different
its a bitwise and instead of a boolean and. Lets go into a Javascript
console and look at bitwise vs boolean and for `9` and `4`:
```
> 9 && 4
4
> 9 & 4
0
> 4 && 5
5
> 4 & 5
4
```
Its easy to imagine this turning into a REALLY annoying bug since it would be
intermittent often `x & y` does turn out to be truthy if `x && y` is truthy.
#### what to do about it?
For Javascript, ESLint has a [no-bitwise check][21] check), which
requires you manually flag “no, I actually know what Im doing, I want to do
bitwise and” if you use a bitwise and in your code. Im sure many other linters
have a similar check.
#### thats all for now!
There are definitely more problems with integers than this, but this got pretty
long again and Im tired of writing again so Im going to stop :)
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2023/01/18/examples-of-problems-with-integers/
作者:[Julia Evans][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://jvns.ca/
[b]: https://github.com/lkxed/
[1]: https://jvns.ca/blog/2023/01/13/examples-of-floating-point-problems/
[2]: https://social.jvns.ca/@b0rk/109700446576896509
[3]: https://jvns.ca#example-1-the-small-database-primary-key
[4]: https://jvns.ca#example-2-integer-overflow-underflow
[5]: https://jvns.ca#aside-how-do-computers-represent-negative-integers
[6]: https://jvns.ca#example-3-decoding-a-binary-format-in-java
[7]: https://jvns.ca#example-4-misinterpreting-an-ip-address-or-string-as-an-integer
[8]: https://jvns.ca#example-5-security-problems-because-of-integer-overflow
[9]: https://jvns.ca#example-6-the-case-of-the-mystery-byte-order
[10]: https://jvns.ca#example-7-modulo-of-negative-numbers
[11]: https://jvns.ca#example-8-compilers-removing-integer-overflow-checks
[12]: https://jvns.ca#example-9-the-typo
[13]: https://github.com/golang/go/issues/30613
[14]: https://en.wikipedia.org/wiki/Signed_number_representations
[15]: https://go.dev/play/p/iSFxbFAe75M
[16]: https://rachelbythebay.com/w/2020/11/26/magic/
[17]: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=integer+overflow
[18]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24795
[19]: https://torstencurdt.com/tech/posts/modulo-of-negative-numbers/
[20]: https://raphlinus.github.io/programming/rust/2018/08/17/undefined-behavior.html
[21]: https://eslint.org/docs/latest/rules/no-bitwise

View File

@ -0,0 +1,386 @@
[#]: subject: "Why does 0.1 + 0.2 = 0.30000000000000004?"
[#]: via: "https://jvns.ca/blog/2023/02/08/why-does-0-1-plus-0-2-equal-0-30000000000000004/"
[#]: author: "Julia Evans https://jvns.ca/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Why does 0.1 + 0.2 = 0.30000000000000004?
======
Hello! I was trying to write about floating point yesterday,
and I found myself wondering about this calculation, with 64-bit floats:
```
>>> 0.1 + 0.2
0.30000000000000004
```
I realized that I didnt understand exactly how it worked. I mean, I know
floating point calculations are inexact, and I know that you cant exactly
represent `0.1` in binary, but: theres a floating point number thats closer to
0.3 than `0.30000000000000004`! So why do we get the answer
`0.30000000000000004`?
If you dont feel like reading this whole post with a bunch of calculations, the short answer is that
`0.1000000000000000055511151231257827021181583404541015625 + 0.200000000000000011102230246251565404236316680908203125` lies exactly between
2 floating point numbers,
`0.299999999999999988897769753748434595763683319091796875` (usually printed as `0.3`) and
`0.3000000000000000444089209850062616169452667236328125` (usually printed as `0.30000000000000004`). The answer is
`0.30000000000000004` (the second one) because its significand is even.
#### how floating point addition works
This is roughly how floating point addition works:
- Add together the numbers (with extra precision)
- Round the result to the nearest floating point number
So lets use these rules to calculate 0.1 + 0.2. I just learned how floating
point addition works yesterday so its possible Ive made some mistakes in this
post, but I did get the answers I expected at the end.
#### step 1: find out what 0.1 and 0.2 are
First, lets use Python to figure out what the exact values of `0.1` and `0.2` are, as 64-bit floats.
```
>>> f"{0.1:.80f}"
'0.10000000000000000555111512312578270211815834045410156250000000000000000000000000'
>>> f"{0.2:.80f}"
'0.20000000000000001110223024625156540423631668090820312500000000000000000000000000'
```
These really are the exact values: because floating point numbers are in base
2, you can represent them all exactly in base 10. You just need a lot of digits
sometimes :)
#### step 2: add the numbers together
Next, lets add those numbers together. We can add the fractional parts together as integers to get the exact answer:
```
>>> 1000000000000000055511151231257827021181583404541015625 + 2000000000000000111022302462515654042363166809082031250
3000000000000000166533453693773481063544750213623046875
```
So the exact sum of those two floating point numbers is `0.3000000000000000166533453693773481063544750213623046875`
This isnt our final answer though because `0.3000000000000000166533453693773481063544750213623046875` isnt a 64-bit float.
#### step 3: look at the nearest floating point numbers
Now, lets look at the floating point numbers around `0.3`. Heres the closest floating point number to `0.3` (usually written as just `0.3`, even though that isnt its exact value):
```
>>> f"{0.3:.80f}"
'0.29999999999999998889776975374843459576368331909179687500000000000000000000000000'
```
We can figure out the next floating point number after `0.3` by serializing
`0.3` to 8 bytes with `struct.pack`, adding 1, and then using `struct.unpack`:
```
>>> struct.pack("!d", 0.3)
b'?\xd3333333'
# manually add 1 to the last byte
>>> next_float = struct.unpack("!d", b'?\xd3333334')[0]
>>> next_float
0.30000000000000004
>>> f"{next_float:.80f}"
'0.30000000000000004440892098500626161694526672363281250000000000000000000000000000'
```
Apparently you can also do this with `math.nextafter`:
```
>>> math.nextafter(0.3, math.inf)
0.30000000000000004
```
So the two 64-bit floats around
`0.3` are
`0.299999999999999988897769753748434595763683319091796875` and
`0.3000000000000000444089209850062616169452667236328125`
#### step 4: find out which one is closest to our result
It turns out that `0.3000000000000000166533453693773481063544750213623046875`
is exactly in the middle of
`0.299999999999999988897769753748434595763683319091796875` and
`0.3000000000000000444089209850062616169452667236328125`.
You can see that with this calculation:
```
>>> (3000000000000000444089209850062616169452667236328125000 + 2999999999999999888977697537484345957636833190917968750) // 2 == 3000000000000000166533453693773481063544750213623046875
True
```
So neither of them is closest.
#### how does it know which one to round to?
In the binary representation of a floating point number, theres a number
called the “significand”. In cases like this (where the result is exactly in
between 2 successive floating point number, itll round to the one with the
even significand.
In this case thats `0.300000000000000044408920985006261616945266723632812500`
We actually saw the significand of this number a bit earlier:
- 0.30000000000000004 is `struct.unpack('!d', b'?\xd3333334')`
- 0.3 is `struct.unpack('!d', b'?\xd3333333')`
The last digit of the big endian hex representation of `0.30000000000000004` is
`4`, so thats the one with the even significand (because the significand is at
the end).
#### lets also work out the whole calculation in binary
Above we did the calculation in decimal, because thats a little more intuitive
to read. But of course computers dont do these calculations in decimal
theyre done in a base 2 representation. So I wanted to get an idea of how that
worked too.
I dont think this binary calculation part of the post is particularly clear
but it was helpful for me to write out. There are a really a lot of numbers and
it might be terrible to read.
#### how 64-bit floats numbers work: exponent and significand
64-bit floating point numbers are represented with 2 integers: an **exponent** and the **significand** and a 1-bit **sign**.
Heres the equation of how the exponent and significand correspond to an actual number
$$\text{sign} \times 2^\text{exponent} (1 + \frac{\text{significand}}{2^{52}})$$
For example if the exponent was `1` the significand was `2**51`, and the sign was positive, wed get
$$2^{1} (1 + \frac{2^{51}}{2^{52}})$$
which is equal to `2 * (1 + 0.5)` , or 3.
#### step 1: get the exponent and significand for 0.1 and 0.2
I wrote some inefficient functions to get the exponent and significand of a positive float in Python:
```
def get_exponent(f):
# get the first 12 bytes
bytestring = struct.pack('!d', f)
return int.from_bytes(bytestring, byteorder='big') >> 52
def get_significand(f):
# get the last 52 bytes
bytestring = struct.pack('!d', f)
x = int.from_bytes(bytestring, byteorder='big')
exponent = get_exponent(f)
return x ^ (exponent << 52)
```
Im ignoring the sign bit (the first bit) because we only need these functions
to work on two numbers (0.1 and 0.2) and those two numbers are both positive.
First, lets get the exponent and significand of 0.1. We need to subtract 1023
to get the actual exponent because thats how floating point works.
```
>>> get_exponent(0.1) - 1023
-4
>>> get_significand(0.1)
2702159776422298
```
The way these numbers work together to get `0.1` is `2**exponent + significand / 2**(52 - exponent)`.
Heres that calculation in Python:
```
>>> 2**-4 + 2702159776422298 / 2**(52 + 4)
0.1
```
(you might legitimately be worried about floating point accuracy issues with
this calculation, but in this case Im pretty sure its fine because these
numbers by definition dont have accuracy issues the floating point numbers starting at `2**-4` go up in steps of `1/2**(52 + 4)`)
We can do the same thing for `0.2`:
```
>>> get_exponent(0.2) - 1023
-3
>>> get_significand(0.2)
2702159776422298
```
And heres how that exponent and significand work together to get `0.2`:
```
>>> 2**-3 + 2702159776422298 / 2**(52 + 3)
0.2
```
(by the way, its not a coincidence that 0.1 and 0.2 have the same significand its because `x` and `2*x` always have the same significand)
#### step 2: rewrite 0.1 to have a bigger exponent
`0.2` has a bigger exponent than `0.1` -3 instead of -4.
So we need to rewrite
```
2**-4 + 2702159776422298 / 2**(52 + 4)
```
to be `X / (2**52 + 3)`
If we solve for X in `2**-4 + 2702159776422298 / 2**(52 + 4) = X / (2**52 + 3)`, we get:
`X = 2**51 + 2702159776422298 /2`
We can calculate that in Python pretty easily:
```
>>> 2**51 + 2702159776422298 //2
3602879701896397
```
#### step 3: add the significands
Now were trying to do this addition
```
2**-3 + 2702159776422298 / 2**(52 + 3) + 3602879701896397 / 2**(52 + 3)
```
So we need to add together `2702159776422298` and `3602879701896397`
```
>>> 2702159776422298 + 3602879701896397
6305039478318695
```
Cool. But `6305039478318695` is more than 2**52 - 1 (the maximum value for a significand), so we have a problem:
```
>>> 6305039478318695 > 2**52
True
```
#### step 4: increase the exponent
Right now our answer is
```
2**-3 + 6305039478318695 / 2**(52 + 3)
```
First, lets subtract 2**52 to get
```
2**-2 + 1801439850948199 / 2**(52 + 3)
```
This is almost perfect, but the `2**(52 + 3)` at the end there needs to be a `2**(52 + 2)`.
So we need to divide 1801439850948199 by 2. This is where we run into inaccuracies `1801439850948199` is odd!
```
>>> 1801439850948199 / 2
900719925474099.5
```
Its exactly in between two integers, so we round to the nearest even number (which is what the floating point specification says to do), so our final floating point number result is:
```
>>> 2**-2 + 900719925474100 / 2**(52 + 2)
0.30000000000000004
```
Thats the answer we expected:
```
>>> 0.1 + 0.2
0.30000000000000004
```
#### this probably isnt exactly how it works in hardware
The way Ive described the operations here isnt literally exactly
what happens when you do floating point addition (its not “solving for X” for
example), Im sure there are a lot of efficient tricks. But I think its about
the same idea.
#### printing out floating point numbers is pretty weird
We said earlier that the floating point number 0.3 isnt equal to 0.3. Its actually this number:
```
>>> f"{0.3:.80f}"
'0.29999999999999998889776975374843459576368331909179687500000000000000000000000000'
```
So when you print out that number, why does it display `0.3`?
The computer isnt actually printing out the exact value of the number, instead
its printing out the _shortest_ decimal number `d` which has the property that
our floating point number `f` is the closest floating point number to `d`.
It turns out that doing this efficiently isnt trivial at all, and there are a bunch of academic papers about it like [Printing Floating-Point Numbers Quickly and Accurately][1]. or [How to print floating point numbers accurately][2].
#### would it be more intuitive if computers printed out the exact value of a float?
Rounding to a nice clean decimal value is nice, but in a way I feel like it
might be more intuitive if computers just printed out the exact value of a
floating point number it might make it seem a lot less surprising when you
get weird results.
To me,
0.1000000000000000055511151231257827021181583404541015625 +
0.200000000000000011102230246251565404236316680908203125
= 0.3000000000000000444089209850062616169452667236328125 feels less surprising than 0.1 + 0.2 = 0.30000000000000004.
Probably this is a bad idea, it would definitely use a lot of screen space.
#### a quick note on PHP
Someone in the comments somewhere pointed out that `<?php echo (0.1 + 0.2 );?>`
prints out `0.3`. Does that mean that floating point math is different in PHP?
I think the answer is no if I run:
`<?php echo (0.1 + 0.2 )- 0.3);?>` on [this
page][3], I get the exact same answer as in
Python 5.5511151231258E-17. So it seems like the underlying floating point
math is the same.
I think the reason that `0.1 + 0.2` prints out `0.3` in PHP is that PHPs
algorithm for displaying floating point numbers is less precise than Pythons
itll display `0.3` even if that number isnt the closest floating point
number to 0.3.
#### thats all!
I kind of doubt that anyone had the patience to follow all of that arithmetic,
but it was helpful for me to write down, so Im publishing this post anyway.
Hopefully some of this makes sense.
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2023/02/08/why-does-0-1-plus-0-2-equal-0-30000000000000004/
作者:[Julia Evans][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://jvns.ca/
[b]: https://github.com/lkxed/
[1]: https://legacy.cs.indiana.edu/~dyb/pubs/FP-Printing-PLDI96.pdf
[2]: https://lists.nongnu.org/archive/html/gcl-devel/2012-10/pdfkieTlklRzN.pdf
[3]: https://replit.com/languages/php_cli

View File

@ -0,0 +1,215 @@
[#]: subject: "Terminal Basics Series #1: Changing Directories in Linux Terminal"
[#]: via: "https://itsfoss.com/change-directories/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Terminal Basics Series #1: Changing Directories in Linux Terminal
======
The cd command in Linux allows you to change directories (folders). You just have to give the path to the directory.
```
cd path_to_directory
```
And here comes the first challenge if you are new to Linux. You are probably not sure about the path.
Let's tackle that first.
### Understanding paths in Linux
The path traces the location in the Linux directory structure. Everything starts at the root and then goes from there.
You can check your current location with the following:
```
pwd
```
It should show an output like /home/username. Of course, it will be your username.
As you can see, paths are composed of / and directory names. Path `/home/abhishek/scripts` means the folder scripts is inside the folder `abhishek`, which is inside the folder `home`. The first `/` is for root (from where the filesystem starts), the trailing / are separators for the directories.
![Path in Linux][1]
> 🖥️ Type `ls /` in the terminal and press enter. It will show you the content of the root directory. Try it.
Now, there are two ways to specify a path: absolute and relative.
**Absolute path**: It starts with the root and then traces the location from there. If a path starts with /, it is an absolute path.
**Relative path**: This path originates from your current location in the filesystem. If I am in the location /home/abhishek and I have to go to /home/abhishek/Documents, I can simply go to Documents instead of specifying the absolute path /home/abhishek/Documents.
Before I show you the difference between the two, you should get familiar with two special directory notations:
- . (single dot) denotes the current directory.
- .. (two dots) denote the parent directory taking you one directory above the current one.
Here's a pictorial representation.
![Absolute path vs relative path][2]
### Changing directory with cd command
Now that you are familiar with the concept of path, let's see how you can change the directory.
> 🖥️ If you **just type cd and press enter**, it will take you to your home directory from any location. Go on, try it.
Enter the following command to see the directories inside your home directories:
```
ls
```
This is what it shows to me:
```
[email protected]:~$ ls
Desktop Downloads Pictures Templates VirtualBoxVMs
Documents Music Public Videos
```
Yours may be similar but not exactly the same.
Let's say you want to go to the Documents directory. Since it is available under the current directory, it will be easier to use the relative path here:
```
cd Documents
```
> 💡 The default terminal emulators of most Linux distributions show you the current location in the prompt itself. You don't have to use pwd all the time just to know where you are.
![Most Linux terminal prompts show the current location][3]
Now, let's say you want to switch to the Templates directory that was located in your home directory.
You can use the relative path `../Templates` (.. takes you to the one directory above Documents to /home/username and from there you go to Templates).
But let's go for the absolute path instead. Please change 'abhishek' with your username.
```
cd /home/abhishek/Templates
```
Now you are in the Templates directory. How about going to the Downloads directory? Use the relative path this time:
```
cd ../Templates
```
Here's a replay of all the above directory change examples you just read.
![cd command example][4]
> 💡 Utilize the tab completion in the terminal. Start typing a few letters of the command and directory and hit the tab key. It will try to autocomplete or show you the possible options. 
### Troubleshooting
You may encounter a few common errors while changing the directories in Linux terminal.
#### No such file or directory
If you see an error like this while changing the directories:
> bash: cd: directory_name: No such file or directory
Then you made mistake with the path or name of the directories. Here are a few things to note.
- Make sure there is no typo in the directory name.
- Linux is case sensitive. Downloads and downloads are not the same.
- You are not specifying the correct path. Perhaps you are in some other location? Or did you miss the first / in the absolute path?
![Common examples of "no such file or directory" error][5]
#### Not a directory
If you see an error like this:
> bash: cd: filename: Not a directory
It means that you are trying to use the cd command with a file, not a directory (folder). Clearly, you cannot enter a file the same way you enter a folder and hence this error.
![Not a directory error with the cd command][6]
#### Too many arguments
Another common rookie Linux mistake:
> bash: cd: too many arguments
The cd commands take only one argument. That means that you can only specify one directory to the command.
If you specify more than one or mistyped a path by adding a space to the path, you'll see this error.
![Too many arguments error in Linux terminal][7]
> 🏋🏻 If you press `cd -`, it will take you to your previous directory. It's quite handy when you are switching between two distant locations. You don't have to type the long paths again.
### Special directory notations
Before ending this tutorial, let me quickly tell you about the special notation `~`. In Linux, ~ is a shortcut for the user's home directory.
If user `abhi` is running it, ~ would mean `/home/abhi` and if user `prakash` was running it, it would mean `/home/prakash`.
To summarize all the special directory notations you learned in this chapter of the terminal basics series:
| Notation | Description |
| :- | :- |
| . | Current directory |
| .. | Parent directory |
| ~ | Home directory |
| - | Previous directory |
### Test your knowledge
Here are a few simple exercises to test your newly learned knowledge of the path and the cd command.
Move to your home directory and create a nested directory structure with this command:
```
mkdir -p sample/dir1/dir2/dir3
```
Now, try this one by one:
- Go to the dir3 using either absolute or relative path
- Move to dir1 using relative path
- Now go to dir2 using the shortest path you can imagine
- Change to the sample directory using absolute path
- Go back to your home directory
> 🔑 Want to know if you got all of them right or not? Feel free to [share your answers in the It's FOSS Community][8].
Now that you know how to change directories, how about you learn about creating them?
I highly recommend reading this article to learn small but useful things about the terminals and the commands.
Stay tuned for more chapters in the Linux Terminal Basics series if you want to learn the essentials of the Linux command line.
And, of course, your feedback on this new series is welcome. What can I do to improve it?
--------------------------------------------------------------------------------
via: https://itsfoss.com/change-directories/
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/content/images/2023/02/path-linux.webp
[2]: https://itsfoss.com/content/images/2023/02/absolute-and-relative-path.png
[3]: https://itsfoss.com/content/images/2023/02/linux-terminal-prompt.png
[4]: https://itsfoss.com/content/images/2023/02/cd-command-example.svg
[5]: https://itsfoss.com/content/images/2023/02/common-errors-with-cd.png
[6]: https://itsfoss.com/content/images/2023/02/not-a-directory-error-linux.png
[7]: https://itsfoss.com/content/images/2023/02/too-many-arguments.png
[8]: https://itsfoss.community/t/exercise-in-changing-directories-in-linux-terminal/10177?ref=its-foss

View File

@ -1,369 +0,0 @@
[#]: subject: "Beginner's Guide to R Markdown Syntax [With Cheat Sheet]"
[#]: via: "https://itsfoss.com/r-markdown/"
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Beginner's Guide to R Markdown Syntax [With Cheat Sheet]
======
You probably already know about the lightweight Markdown markup language. Refer to our [Markdown guide][1], if you're new to the concept. Overall, it is a simple and effective language for creating plain-text documents.
However, Markdown may not be enough to make detailed reports or technical documents.
Hence, **R Markdown** as an **interactive file format** came into existence back in 2014 thanks to packages like [knitr][2] and [Pandoc][3]. It combines plain text with in-line R code, helping you make a dynamic document.
To create R Markdown documents, you can use [various IDEs][4] and extensions to make it possible. However, the official IDE that helps you do it is **RStudio**. So, in this article, we will focus on **learning R Markdown syntax using RStudio**.
💡
If you did not know,
**R programming language**
is used for statistical computing, graphics representation, and reporting.
**Suggested Read 📖**
How to Install and Use R on UbuntuBrief: This tutorial teaches you to install R on Ubuntu. Youll also learn how to run your first R program in Ubuntu using various methods. R, together with Python, is the most commonly used programming language for statistical computing and graphics, making it easy to work with data. With![][5]It's FOSSSergiu![][6]
### Setting RStudio
RStudio makes it easy to work with R Markdown by its setup process. You just need to install a package, and you are done for the most part!
Once you have RStudio installed, head to the Tools menu and select the _Install Packages_ option.
![Select Install Packages option under Tools menu in RStudio][7]
On the new dialog box, search for rmarkdown and install it.
![Install RMarkdown Package by searching it and pressing install button on the new package install dialog box][8]
💡
To use code chunks like python, you need to install additional packages. RStudio will prompt you to install the required packages when you try to include them in your document.
Once installed, you can start a new rmarkdown document by selecting **File > New > RMarkdown**.
![Create a new RMarkdown Document from File menu][9]
This will prompt you to add some information regarding the document (metadata for the file). Fill those up.
![Provide the title and other details for new document in rmarkdown][10]
Or you can create an empty document to start fresh.
### RMarkdown Syntax
Since it is just "**enhanced Markdown**," most syntax remains the same.
There would be some differences when you add things not usually supported with Markdown, like **tables, math equations, code chunks, etc.**
Here's a quick summary of what we will be covering:
Name of the RMarkdown BlockProper Syntax |
| Heading | # Level 1## Level 2### Level 3Level 1=======Level 2------- |
| Emphasis | *Italics*_Italics_**Bold**__Bold__ |
| List | Unordered List* Item* Item + Sub + SubOrdered List1. Item2. Item + Sub + Sub |
| Code Chunk | Normal Code Block```Code Goes Here```R Code Block```{r}R CODE```You can use other languages also.Inline `code` |
| Links | Plain Link: Paste the URLLink with Caption: [Text](URL_Address)Link to a section: [Text](#Name-of-section) |
| Table | | Column | Column | Column || ------ | ------ | ------ || Item | Item | Item || Item | Item | Item | |
| Equations | In line Equations: $Equations$Display Equations: $$Equations$$ |
| Images | Without Caption: ![](Link-to-Image)With Caption : ![optional caption text](Location-of-image) |
| Block Quotes | > Type your Block Quotes |
| Misc | Super Script : Text^Superscript^Horizontal rule or Page Break:========= or ----------For Manual Line break, end line with 2+ spaces |
#### The YAML Header
At the top of a Rmarkdown document, there is a YAML header enclosed within two `---`. This block usually contains a title, author, date, and the file type you want to output, defining the **final look of the document.**
The file type is either **HTML, PDF, or Word.**
```
---
title: "Sample"
author: "It's FOSS"
date: "2023-02-08"
output: pdf_document
---
```
This can be added while setting the new document in RStudio, which is shown in the above section.
#### Heading
In R Markdown, we can give heading in two different methods. Either we can use the # character for different levels of heading like:
```
# Heading Level 1
## Heading Level 2
### Heading Level 3
#### Heading Level 4
##### Heading Level 5
###### Heading Level 6
```
Or, `=` and `-` for level 1 and 2 headings, respectively.
```
Level 1 Heading
===============
Level 2 Heading
---------------
```
![various types of heading levels in rmarkdown file][11]
#### Lists
There are two types of Lists, the first one is an **Unordered list**, or you could call them bullet points:
```
* Item 1
* Item 2
+ Sub 1
+ Sub 2
* Item 3
```
And the second one is the **Ordered list**, which is the numbered type:
```
1. Item 1
2. Item 2
+ Sub 1
+ Sub 2
3. Item 3
```
![order and unordered list example][12]
**Suggested Read 📖**
Read and Organize Markdown Files in Linux Terminal With GlowGlow is a CLI tool that lets you render Markdown files in the Linux terminal. You can also organize Markdown files with it.![][13]It's FOSSAbhishek Prakash![][14]
#### Format text within a paragraph
There are several ways to format text.
![][15]
You can add emphasis to the text like italics or bold using:
- Italics: Place the text in between single asterisks or single underscore
- Bold: Place the text in between double asterisks or double underscores.
```
*This is Italicized text*
_This is Italicized text_
**This is Bold Text**
__This is Bold Text__
```
You can explore on this using our resource on [how to add bold and italic text in Markdown][16].
If you want to add superscript to a text, place the text that should be superscript in between `^` symbol.
```
Normal Text^super_script^
```
Or, if you want to add text strike-through, place the text in between two `~~` symbol.
```
~Strike Through this~~
```
![][17]
#### Adding Code Chunks
Embedding code is the primary purpose of R Markdown. It allows us to add codes in several ways.
**Adding Normal code block.**
If you want to add a normal code block to separate it from other text, use the syntax below:
```
```
Your Code Goes Here
```
```
You can also try [adding code blocks with syntax highlighting][18].
You should append the language in curly braces if you want to add code and embed its output to the document:
```
```{Language}
Your Code Goes Here
```
```
Or, you can add inline codes by placing the respective text between ` symbols.
```
The `code` is a code
```
Here's how it should look like:
![][19]
#### Links
To add a link as plain text, just paste the link as it is in a line.
```
https://itsfoss.com
```
Or, to make a text hyperlink, use the syntax:
```
[Text](URL Address)
```
Another way to add a link is, when you want to link to a section of the page. In this case, use the syntax:
```
[Text](#Name-of-section)
```
![][20]
#### Tables
The syntax for adding tables is similar to that of markdown.
```
|Column|Column|Column|
| --- | --- | --- |
|Item|Item|Item|
|Item|Item|Item|
```
![][21]
📋
Curious to know more? Refer to our guide on
[creating tables in Markdown][22]
.
#### Images
To add an image, use the syntax:
```
![](http://example.com/logo.png)
OR
![optional caption text](figures/img.png)
```
![][23]
#### Block Quotes
RMarkdown allows you to add block quotes. To use this, use the **> (greater than)** symbol in front of the line/paragraph you want to quote.
```
This is a normal text
> This is a Block Quote
```
![][24]
If you want to explore more use cases of blockquote, head to our [Markdown quotes][25] guide.
#### Equations
Using RMarkdown, you can add either equations or display complex LaTex equations.
For example:
```
In line Pythagorean Theorem: $Equation$
Display Equation: $$Equation$$
```
![adding equations in R Markdown document][26]
#### Horizontal Rule / Page Break
Use three or more asterisks or dashes to add a horizontal rule /page break.
```
************
------------
```
If you want to add a manual line break, end that line with two or more spaces.
### Summary
### R Markdown is Useful (Cheat Sheet)
Whether you are working with scientific reports or want to create any other type of dynamic document, R Markdown is your best bet to make the most out of Markdown.
Here's a cheat sheet to help you summarize it all:
![][27]
[R Markdown Cheat SheetR Markdown Cheat Sheet.pdf145 KBdownload-circle][28]
_💬 Did we miss something that you use with R Markdown? Share your thoughts in the comments down below._
--------------------------------------------------------------------------------
via: https://itsfoss.com/r-markdown/
作者:[Sreenath][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://itsfoss.com/author/sreenath/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/markdown-guide/
[2]: https://www.r-project.org/nosvn/pandoc/knitr.html
[3]: https://itsfoss.comknitr, and Pandoc
[4]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[5]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
[6]: https://itsfoss.com/content/images/wordpress/2019/06/install-r-on-ubuntu.jpg
[7]: https://itsfoss.com/content/images/2023/02/select-install-packages.png
[8]: https://itsfoss.com/content/images/2023/02/install-rmarkdown-1.png
[9]: https://itsfoss.com/content/images/2023/02/new-r-markdown.png
[10]: https://itsfoss.com/content/images/2023/02/new-document-in-rmark.png
[11]: https://itsfoss.com/content/images/2023/02/Headings.png
[12]: https://itsfoss.com/content/images/2023/02/List.png
[13]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
[14]: https://itsfoss.com/content/images/wordpress/2022/01/glow-cli-markdown.png
[15]: https://itsfoss.com/content/images/2023/02/emphasis.png
[16]: https://itsfoss.com/markdown-bold-italic/
[17]: https://itsfoss.com/content/images/2023/02/superescript.png
[18]: https://itsfoss.com/markdown-code-block/
[19]: https://itsfoss.com/content/images/2023/02/code-chunk.png
[20]: https://itsfoss.com/content/images/2023/02/links.png
[21]: https://itsfoss.com/content/images/2023/02/table.png
[22]: https://itsfoss.com/markdown-table/
[23]: https://itsfoss.com/content/images/2023/02/images.png
[24]: https://itsfoss.com/content/images/2023/02/block-quotes.png
[25]: https://itsfoss.com/markdown-quotes/
[26]: https://itsfoss.com/content/images/2023/02/equations.png
[27]: https://itsfoss.com/content/images/2023/02/R-Markdown-Cheat-Sheet.webp
[28]: https://itsfoss.com/content/files/2023/02/R-Markdown-Cheat-Sheet.pdf

View File

@ -1,111 +0,0 @@
[#]: subject: "How to Install IDLE Python IDE in Ubuntu and Other Linux"
[#]: via: "https://www.debugpoint.com/install-idle-ubuntu-linux/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install IDLE Python IDE in Ubuntu and Other Linux
======
**Pythons default IDE IDLE is not installed by default in Ubuntu and other distros. Learn how to install it in this guide.**
IDLE (**I**ntegrated **D**evelopment and **L**earning **E**nvironment) is a [Python IDE][1], written in Python language itself and usually gets installed in Windows as part of [Python installation][2]. It is ideal for beginners and straightforward to use. For those who are learning Python, such as students, it can be a good IDE to start with.
Basic features such as syntax highlighting, smart ident, and auto-completion are some of the features of this IDE. You can always learn more about the IDLE features in the official [documentation][3].
### IDLE in Ubuntu and other Linux
All Linux distributions, including Ubuntu, come with Python pre-installed. Even if you manually upgrade or install Python versions, the IDLE IDE doesnt come with that. You have to install it manually.
For **Debian, Ubuntu, Linux Mint and related distribution** open a terminal and run the following command to install IDLE.
```
sudo apt update
```
```
sudo apt install idle3
```
Hit yes when the command asks you whether you want to install IDLE or not. After the command is complete, IDLE will be installed in your Ubuntu system.
For **Fedora, RHEL, CentOS**, use the following command to install it.
```
sudo dnf update
```
```
sudo dnf install idle3
```
**Arch Linux** users can install it using the following command.
```
sudo pacman -S python tk
```
![IDLE install and run in Ubuntu][4]
### Launching IDLE and writing a sample program to test
After the installation in Ubuntu, Debian, Linux Mint, and Fedora you can find the IDLE icon in the application menu. See below.
![IDLE icon in the application menu][5]
If you are using Arch Linux, you need to run below from the command line to launch IDLE.
```
idle
```
Once you launch IDLE, you should see the main window, as shown in the image below.
![IDLE editor main window][6]
By default, it shows you a shell where you can directly execute Python codes in each line. It works like any shell interpreter. And when you hit enter, you get the output, and the three “>” symbols go to the next line for the next command.
![Running a simple Python statement in IDLE][7]
IDLE also allows you to open any .py file from its file menu. It will open the file in a separate window where you can make changes and run it directly. You can run using F5 or from the option Run > Run Module.
![A python file opened from IDLE][8]
![Option to Run the file using menu][9]
The output is shown in a separate output window. From the output window, you can start debugging, step into a line or file, view stack trace and other options.
![Output is shown in a separate output window of IDLE][10]
### Closing Notes
Now you learned how to install the IDLE IDE in Ubuntu and other distributions and how to run a statement or a Python program. IDLE can be a good starting point for beginners to grasp the basics before heading over to more complex IDEs.
I hope this guide helps you on your Python journey.
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/install-idle-ubuntu-linux/
作者:[Arindam][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.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://www.debugpoint.com/5-best-python-ide-code-editor/
[2]: https://www.debugpoint.com/install-python-windows/
[3]: https://docs.python.org/3/library/idle.html
[4]: https://www.debugpoint.com/wp-content/uploads/2023/02/IDLE-install-and-run-in-Ubuntu.jpg
[5]: https://www.debugpoint.com/wp-content/uploads/2023/02/IDLE-icon-in-the-application-menu.jpg
[6]: https://www.debugpoint.com/wp-content/uploads/2023/02/IDLE-editor-main-window.jpg
[7]: https://www.debugpoint.com/wp-content/uploads/2023/02/Running-a-simple-Python-statement-in-IDLE.jpg
[8]: https://www.debugpoint.com/wp-content/uploads/2023/02/A-python-file-opened-from-IDLE.jpg
[9]: https://www.debugpoint.com/wp-content/uploads/2023/02/Option-to-Run-the-file-using-menu.jpg
[10]: https://www.debugpoint.com/wp-content/uploads/2023/02/Output-is-shown-in-a-separate-output-window-of-IDLE.jpg

View File

@ -0,0 +1,381 @@
[#]: subject: "Some notes on using nix"
[#]: via: "https://jvns.ca/blog/2023/02/28/some-notes-on-using-nix/"
[#]: author: "Julia Evans https://jvns.ca/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Some notes on using nix
======
Recently I started using a Mac for the first time. The biggest downside Ive
noticed so far is that the package management is much worse than on Linux.
At some point I got frustrated with homebrew because I felt like it was
spending too much time upgrading when I installed new packages, and so I
thought maybe Ill try the [nix][1] package manager!
nix has a reputation for being confusing (it has its whole
own programming language!), so Ive been trying to figure out how to use nix in
a way thats as simple as possible and does not involve managing any
configuration files or learning a new programming language. Heres what Ive
figured out so far! Well talk about how to:
- install packages with nix
- build a custom nix package for a C++ program called [paperjam][2]
- install a 5-year-old version of [hugo][3] with nix
As usual Ive probably gotten some stuff wrong in this post since Im still
pretty new to nix. Im also still not sure how much I like nix its very
confusing! But its helped me compile some software that I was struggling to
compile otherwise, and in general it seems to install things faster than
homebrew.
#### whats interesting about nix?
People often describe nix as “declarative package management”. I dont
care that much about declarative package management, so here are two things
that I appreciate about nix:
- It provides binary packages (hosted at [https://cache.nixos.org/][4]) that you can quickly download and install
- For packages which dont have binary packages, it makes it easier to compile them
I think that the reason nix is good at compiling software is that:
- you can have multiple versions of the same library or program installed at a time (you could have 2 different versions of libc for instance). For example I have two versions of node on my computer right now, one at `/nix/store/4ykq0lpvmskdlhrvz1j3kwslgc6c7pnv-nodejs-16.17.1` and one at `/nix/store/5y4bd2r99zhdbir95w5pf51bwfg37bwa-nodejs-18.9.1`.
- when nix builds a package, it builds it in isolation, using only the
specific versions of its dependencies that you explicitly declared. So
theres no risk that the package secretly depends on another package on your
system that you dont know about. No more fighting with `LD_LIBRARY_PATH`!
- a lot of people have put a lot of work into writing down all of the
dependencies of packages
Ill give a couple of examples later in this post of two times nix made it easier for me to compile software.
#### how I got started with nix
heres how I got started with nix:
- Install nix. I forget exactly how I did this, but it looks like theres an [official installer][5] and an [unofficial installer from zero-to-nix.com][6]. The [instructions for uninstalling nix on MacOS with the standard multi-user install][7] are a bit complicated, so it might be worth choosing an installation method with simpler uninstall instructions.
- Put `~/.nix-profile/bin` on my PATH
- Install packages with `nix-env -iA nixpkgs.NAME`
- Thats it.
Basically the idea is to treat `nix-env -iA` like `brew install` or `apt-get install`.
For example, if I want to install `fish`, I can do that like this:
```
nix-env -iA nixpkgs.fish
```
This seems to just download some binaries from [https://cache.nixos.org][8] pretty simple.
Some people use nix to install their Node and Python and Ruby packages, but I havent
been doing that I just use `npm install` and `pip install` the same way I
always have.
#### some nix features Im not using
There are a bunch of nix features/tools that Im not using, but that Ill
mention. I originally thought that you _had_ to use these features to use nix,
because most of the nix tutorials Ive read talk about them. But you dont have to use them.
- NixOS (a Linux distribution)
- [nix-shell][9]
- [nix flakes][10]
- [home-manager][11]
- [devenv.sh][12]
I wont go into these because I havent really used them and there are lots of
explanations out there.
#### where are nix packages defined?
I think packages in the main nix package repository are defined in [https://github.com/NixOS/nixpkgs/][13]
It looks like you can search for packages at [https://search.nixos.org/packages][14]. The two official ways to search packages seem to be:
- `nix-env -qaP NAME`, which is very extremely slow and which I havent been able to get to actually work
- `nix --extra-experimental-features 'nix-command flakes' search nixpkgs NAME`, which does seem to work but is kind of a mouthful. Also all of the packages it prints out start with `legacyPackages` for some reason
I found a way to search nix packages from the command line that I liked better:
- Run `nix-env -qa '*' > nix-packages.txt` to get a list of every package in the Nix repository
- Write a short `nix-search` script that just greps `packages.txt` (`cat ~/bin/nix-packages.txt | awk '{print $1}' | rg "$1"`)
#### everything is installed with symlinks
One of nixs major design choices is that there isnt one single `bin` with all
your packages, instead you use symlinks. There are a lot of layers of symlinks. A few examples of symlinks:
- `~/.nix-profile` on my machine is (indirectly) a symlink to `/nix/var/nix/profiles/per-user/bork/profile-111-link/`
- `~/.nix-profile/bin/fish` is a symlink to `/nix/store/afkwn6k8p8g97jiqgx9nd26503s35mgi-fish-3.5.1/bin/fish`
When I install something, it creates a new `profile-112-link` directory with new symlinks and updates my `~/.nix-profile` to point to that directory.
I think this means that if I install a new version of `fish` and I dont like it, I can
easily go back just by running `nix-env --rollback` itll move me to my previous profile directory.
#### uninstalling packages doesnt delete them
If I uninstall a nix package like this, it doesnt actually free any hard drive space, it just removes the symlinks.
```
$ nix-env --uninstall oil
```
Im still not sure how to actually delete the package I ran a garbage collection like this, which seemed to delete some things:
```
$ nix-collect-garbage
...
85 store paths deleted, 74.90 MiB freed
```
But I still have `oil` on my system at `/nix/store/8pjnk6jr54z77jiq5g2dbx8887dnxbda-oil-0.14.0`.
Theres a more aggressive version of `nix-collect-garbage` that also deletes old versions of your profiles (so that you cant rollback)
```
$ nix-collect-garbage -d --delete-old
```
That doesnt delete `/nix/store/8pjnk6jr54z77jiq5g2dbx8887dnxbda-oil-0.14.0` either though and Im not sure why.
#### upgrading
It looks like you can upgrade nix packages like this:
```
nix-channel --update
nix-env --upgrade
```
(similar to `apt-get update && apt-get upgrade`)
I havent really upgraded anything yet. I think that if something goes wrong with an upgrade, you can roll back (because everything is immutable in nix!) with
```
nix-env --rollback
```
Someone linked me to [this post from Ian Henry][15] that
talks about some confusing problems with `nix-env --upgrade` maybe it
doesnt work the way youd expect? I guess Ill be wary around upgrades.
#### next goal: make a custom package of paperjam
After a few months of installing existing packages, I wanted to make a custom package with nix for a program called [paperjam][2] that wasnt already packaged.
I was actually struggling to compile `paperjam` at all even without nix because the version I had
of `libiconv` I has on my system was wrong. I thought it might be easier to
compile it with nix even though I didnt know how to make nix packages yet. And
it actually was!
But figuring out how to get there was VERY confusing, so here are some notes about how I did it.
#### how to build an example package
Before I started working on my `paperjam` package, I wanted to build an example existing package just to
make sure I understood the process for building a package. I was really
struggling to figure out how to do this, but I asked in Discord and someone
explained to me how I could get a working package from [https://github.com/NixOS/nixpkgs/][13] and build it. So here
are those instructions:
**step 1:** Download some arbitrary package from [nixpkgs][13] on github, for example the `dash` package:
```
wget https://raw.githubusercontent.com/NixOS/nixpkgs/47993510dcb7713a29591517cb6ce682cc40f0ca/pkgs/shells/dash/default.nix -O dash.nix
```
**step 2**: Replace the first statement (`{ lib , stdenv , buildPackages , autoreconfHook , pkg-config , fetchurl , fetchpatch , libedit , runCommand , dash }:` with `with import <nixpkgs> {};` I dont know why you have to do this,
but it works.
**step 3**: Run `nix-build dash.nix`
This compiles the package
**step 4**: Run `nix-env -i -f dash.nix`
This installs the package into my `~/.nix-profile`
Thats all! Once Id done that, I felt like I could modify the `dash` package and make my own package.
#### how I made my own package
`paperjam` has one dependency (`libpaper`) that also isnt packaged yet, so I needed to build `libpaper` first.
Heres `libpaper.nix`. I basically just wrote this by copying and pasting from
other packages in the [nixpkgs][13] repository.
My guess is whats happening here is that nix has some default rules for
compiling C packages (like “run `make install`”), so the `make install` happens
default and I dont need to configure it explicitly.
```
with import <nixpkgs> {};
stdenv.mkDerivation rec {
pname = "libpaper";
version = "0.1";
src = fetchFromGitHub {
owner = "naota";
repo = "libpaper";
rev = "51ca11ec543f2828672d15e4e77b92619b497ccd";
hash = "sha256-S1pzVQ/ceNsx0vGmzdDWw2TjPVLiRgzR4edFblWsekY=";
};
buildInputs = [ ];
meta = with lib; {
homepage = "https://github.com/naota/libpaper";
description = "libpaper";
platforms = platforms.unix;
license = with licenses; [ bsd3 gpl2 ];
};
}
```
Basically this just tells nix how to download the source from GitHub.
I built this by running `nix-build libpaper.nix`
Next, I needed to compile `paperjam`. Heres a link to the [nix package I wrote][16]. The main things I needed to do other than telling it where to download the source were:
- add some extra build dependencies (like `asciidoc`)
- set some environment variables for the install (`installFlags = [ "PREFIX=$(out)" ];`) so that it installed in the correct directory instead of `/usr/local/bin`.
I set the hashes by first leaving the hash empty, then running `nix-build` to get an error message complaining about a mismatched hash. Then I copied the correct hash out of the error message.
I figured out how to set `installFlags` just by running `rg PREFIX`
in the nixpkgs repository I figured that needing to set a `PREFIX` was
pretty common and someone had probably done it before, and I was right. So I
just copied and pasted that line from another package.
Then I ran:
```
nix-build paperjam.nix
nix-env -i -f paperjam.nix
```
and then everything worked and I had `paperjam` installed! Hooray!
#### next goal: install a 5-year-old version of hugo
Right now I build this blog using Hugo 0.40, from 2018. I dont need any new
features so I havent felt a need to upgrade. On Linux this is easy: Hugos
releases are a static binary, so I can just download the 5-year-old binary from
the [releases page][17] and
run it. Easy!
But on this Mac I ran into some complications. Mac hardware has changed in the
last 5 years, so the Mac Hugo binary I downloaded crashed. And when I tried to
build it from source with `go build`, that didnt work either because Go build
norms have changed in the last 5 years as well.
I was working around this by running Hugo in a Linux docker container, but I
didnt love that: it was kind of slow and it felt silly. It shouldnt be that
hard to compile one Go program!
Nix to the rescue! Heres what I did to install the old version of Hugo with
nix.
#### installing Hugo 0.40 with nix
I wanted to install Hugo 0.40 and put it in my PATH as `hugo-0.40`. Heres how
I did it. I did this in a kind of weird way, but it worked ([Searching and installing old versions of Nix packages][18]
describes a probably more normal method).
**step 1**: Search through the nixpkgs repo to find Hugo 0.40
I found the `.nix` file here [https://github.com/NixOS/nixpkgs/blob/17b2ef2/pkgs/applications/misc/hugo/default.nix][19]
**step 2**: Download that file and build it
I downloaded that file (and another file called `deps.nix` in the same directory), replaced the first line with `with import <nixpkgs> {};`, and built it with `nix-build hugo.nix`.
That almost worked without any changes, but I had to make two changes:
- replace `with stdenv.lib` to `with lib` for some reason.
- rename the package to `hugo040` so that it wouldnt conflict with the other version of `hugo` that I had installed
**step 3**: Rename `hugo` to `hugo-0.40`
I write a little post install script to rename the Hugo binary.
```
postInstall = ''
mv $out/bin/hugo $out/bin/hugo-0.40
'';
```
I figured out how to run this by running `rg 'mv '` in the nixpkgs repository and just copying and modifying something that seemed related.
**step 4**: Install it
I installed into my `~/.nix-profile/bin` by running `nix-env -i -f hugo.nix`.
And it all works! I put the final `.nix` file into my own personal [nixpkgs repo][20] so that I can use it again later if I
want.
#### reproducible builds arent magic, theyre really hard
I think its worth noting here that this `hugo.nix` file isnt magic the
reason I can easily compile Hugo 0.40 today is that many people worked for a long time to make it possible to
package that version of Hugo in a reproducible way.
#### thats all!
Installing `paperjam` and this 5-year-old version of Hugo were both
surprisingly painless and actually much easier than compiling it without nix,
because nix made it much easier for me to compile the `paperjam` package with
the right version of `libiconv`, and because someone 5 years ago had already
gone to the trouble of listing out the exact dependencies for Hugo.
I dont have any plans to get much more complicated with nix (and its still
very possible Ill get frustrated with it and go back to homebrew!), but well
see what happens! Ive found it much easier to start in a simple way and then
start using more features if I feel the need instead of adopting a whole bunch
of complicated stuff all at once.
I probably wont use nix on Linux Ive always been happy enough with `apt`
(on Debian-based distros) and `pacman` (on Arch-based distros), and theyre
much less confusing. But on a Mac it seems like it might be worth it. Well
see! Its very possible in 3 months Ill get frustrated with nix and just go back to homebrew.
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2023/02/28/some-notes-on-using-nix/
作者:[Julia Evans][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://jvns.ca/
[b]: https://github.com/lkxed/
[1]: https://nixos.org/
[2]: https://mj.ucw.cz/sw/paperjam/
[3]: https://github.com/gohugoio/hugo/
[4]: https://cache.nixos.org/
[5]: https://nixos.org/download
[6]: https://zero-to-nix.com/concepts/nix-installer
[7]: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos
[8]: https://cache.nixos.org
[9]: https://nixos.org/guides/nix-pills/developing-with-nix-shell.html
[10]: https://nixos.wiki/wiki/Flakes
[11]: https://github.com/nix-community/home-manager
[12]: https://devenv.sh/
[13]: https://github.com/NixOS/nixpkgs/
[14]: https://search.nixos.org/packages
[15]: https://ianthehenry.com/posts/how-to-learn-nix/my-first-package-upgrade/
[16]: https://github.com/jvns/nixpkgs/blob/22b70a48a797538c76b04261b3043165896d8f69/paperjam.nix
[17]: https://github.com/gohugoio/hugo/releases/tag/v0.40
[18]: https://lazamar.github.io/download-specific-package-version-with-nix/
[19]: https://github.com/NixOS/nixpkgs/blob/17b2ef2/pkgs/applications/misc/hugo/default.nix
[20]: https://github.com/jvns/nixpkgs/

View File

@ -1,159 +0,0 @@
[#]: subject: "How to Install PgAdmin4 on RHEL 9 Step by Step"
[#]: via: "https://www.linuxtechi.com/how-to-install-pgadmin-on-rhel/"
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install PgAdmin4 on RHEL 9 Step by Step
======
Pgadmin4is a free and opensource web-based administration and development platform for PostgreSQL. It interacts with PostgreSQL database server on both local and remote servers and displays server statistics using intuitive and interactive dashboards.
Pgadmin4 is a rewrite of Pgadmin 3 and provides the following notable features:
- A responsive web UI with intutive and real-time monitoring dashboards
- An improved web interface with cool and new panels and icons.
- An SQL query editor with syntax highlighting.
- Extensive documentation.
- Useful tips to help you get started.
In this guide, we will demonstrate how to install Pgadmin4 on RHEL 9.
##### Prerequisites
Before you begin, ensure that you have a RHEL 9 server instance with PostgreSQL database server installed. Check out guide on how to install PostgreSQL 15 on RHEL 9.
With PostgreSQL server installed, carry on with the following steps.
### Step 1) Add Pgadmin4 Repository on RHEL 9
The first step is to add the Pgadmin4 repository on RHEL 9. But first, install the EPEL repository which provides essential software packages.
```
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
```
Next, install Pgadmin4s repository as follows.
```
$ sudo dnf install -y https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
```
Once done, build a cache for Pgadmin4 and EPEL repositories as follows.
```
$ sudo dnf makecache
```
### Step 2) Install PgAdmin4 on RHEL 9
Once the Pgadmin4 and EPEL repositories are in place, proceed and install Pgadmin4 using the DNF package manager as shown.
```
$ sudo dnf install pgadmin4 -y
```
This installs a myriad of packages including Pgadmin4, Apache HTTP web servers, and Python packages to mention a few.
To confirm that Pgadmin4 has been installed, run the following command:
```
$ rpm -qi pgadmin4
```
This prints out quite some information including the name, version, release, and architecture of the installed package.
### Step 3) Start / Enable PgAdmin4 on RHEL 9
At this point, Pgadmin4 is successfully installed. However, you need to go a step further and get it running. To start the Pgadmin4 service, run the command:
```
$ sudo systemctl start httpd
```
Be sure also to enable the service to start every time the system boots.
```
$ sudo systemctl enable httpd
```
To confirm that Pgadmin4 is running run the command:
```
$ sudo systemctl status httpd
```
### Step 4) Initializing PgAdmin4 on RHEL 9
The Pgadmin4 package provides a configurable script for setting up the pgAdmin web service. This allows you to create a user account which is used to authenticate and configure SELinux policies and Apache web server.
Therefore, run the script as follows.
```
$ sudo /usr/pgadmin4/bin/setup-web.sh
```
Provide the email and password that you will use as login credentials on the login page.
NOTE:Sometimes, you may encounter a semanage: command not found error as shown in the output below. This indicates that the semanage package is missing.
Semanage, short for SELinux (Security-Enhanced Linux) policy management tool, is a utility used to configure some aspects of SELinux policy without requiring modification to or recompilation from policy sources.
To fix this error, you need to check for the package that provides semanage. You can do this by running the command:
```
$ sudo dnf provides /usr/sbin/semanage
```
From the output, you can see that semanage is provided by the  policycoreutils-python-utils-3.3-6.el9_0.noarch  package.
To install this package, run the following command.
```
$ sudo dnf install policycoreutils-python-utils -y
```
Once again, run the Pgadmn4 installation script as shown.  Provide the email address and password and type y when prompted.
```
$ sudo /usr/pgadmin4/bin/setup-web.sh
```
### Step 5) Access the Pgadmin4 Web Interface
At this point, Pgadmin4 is successfully installed. To access it from a web browser, head over to the following address:
http://server-ip/pgadmin4
You will get the following login web interface. Be sure to provide the Email and password you provided when running the installation script and click Login.
Once logged in, the Pgadmin4 dashboard will come to view as shown.
To add a server that can be administered by Pgadmin4, click Add New Server
On the General tab fill out the name of the server and add comments for better description.
Next, click Connection and fill out the Hostname/Address , Port , maintenance database , username and password. Then finally click Save.
Thereafter, you will see PosrgreSQL server statistics displayed on interactive and intuitive dashboards. On the left sidebar, you can browse various PostgreSQL parameters.
##### Conclusion
We hope you found this guide informative, kindly do post your queries and feedback in below comments section.
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/how-to-install-pgadmin-on-rhel/
作者:[Pradeep Kumar][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.linuxtechi.com/author/pradeep/
[b]: https://github.com/lkxed/

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