mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-28 23:20:10 +08:00
commit
cfeb6cfa39
191
published/20210207 The Real Novelty of the ARPANET.md
Normal file
191
published/20210207 The Real Novelty of the ARPANET.md
Normal file
@ -0,0 +1,191 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (aREversez)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-15139-1.html)
|
||||
[#]: subject: (The Real Novelty of the ARPANET)
|
||||
[#]: via: (https://twobithistory.org/2021/02/07/arpanet.html)
|
||||
[#]: author: (Two-Bit History https://twobithistory.org)
|
||||
|
||||
ARPANET 的真正创新之处
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/14/180115j5hae51hv1a1ohp5.jpg)
|
||||
|
||||
如果你在搜索引擎中输入“ARPANET”,搜索相关图片,你会看到许多地图的图片,上面是这个上世纪六十年代末七十年代初 [美国政府创建的研究网络][1],该网络不断延伸扩展,横跨了整个美国。我猜很多人第一次了解到 ARPANET 的时候都看过这种地图。
|
||||
|
||||
可以说,这些地图很有意思,毕竟我们很难想象过去连接网络的计算机是那么少,就连如此低保真的图片都可以表示出美国全部机器的所在位置(这里的<ruby>低保真<rt>lo-fi</rt></ruby>指的是高射投影仪成像技术,而不是大家熟知的 lo-fi 氛围音乐)。不过,这些地图是有问题的。地图上用加粗的线条连接着大陆各地,强化了人们的一种观念:ARPANET 最大的贡献就是首次将横跨美国东西两地的电脑连接了起来。
|
||||
|
||||
今天,即便是在病毒肆虐、人们困居家中的情况下,网络也能把我们联系起来,可谓是我们的生命线。所以,如果认为 ARPANET 是最早的互联网,那么在那之前世界必然相互隔绝,毕竟那时还没有今天的互联网,对吧?ARPANET 首次通过计算机将人们连接起来,一定是一件惊天动地的大事。
|
||||
|
||||
但是,这一观点却与历史事实不符,而且它也没有进一步解释 ARPANET 的重要性。
|
||||
|
||||
### 初露锋芒
|
||||
|
||||
华盛顿希尔顿酒店坐落于<ruby>国家广场<rt>National Mall</rt></ruby>东北方向约 2.4 千米处的一座小山丘山顶附近。酒店左右两侧白色的现代化立面分别向外延展出半个圆形,活像一只飞鸟的双翼。1965 年,酒店竣工之后,《纽约时报》报道称这座建筑物就像“一只栖息在山顶巢穴上的海鸥” [^1]。
|
||||
|
||||
不过,这家酒店最有名的特点却深藏在地下。在车道交汇处下方,有着一个巨大的蛋形活动场地,这就是人们熟知的<ruby>国际宴会厅<rt>International Ballroom</rt></ruby>,多年来一直是华盛顿特区最大的无柱宴会厅。1967 年,大门乐队在此举办了一场音乐会。1968 年,“吉他之神”吉米·亨德里克斯也在此举办了一场音乐会。到了 1972 年,国际宴会厅隐去了以往的喧嚣,举办了首届<ruby>国际计算机通信会议<rt>International Conference on Computing Communication</rt></ruby>(ICCC)。在这场大会上,研究项目 ARPANET 首次公开亮相。
|
||||
|
||||
这场会议举办时间为 10 月 24-26 日,与会人数约八百人 [^2]。在这场大会上,计算机网络这一新兴领域的领袖人物齐聚一堂。<ruby>因特网<rt>internet</rt></ruby>的先驱<ruby>鲍勃·卡恩<rt>Bob Kahn</rt></ruby>称,“如果有人在华盛顿希尔顿酒店上方丢了一颗炸弹,那么美国的整个网络研究领域将会毁于一旦” [^3]。
|
||||
|
||||
当然,不是所有的与会人员都是计算机科学家。根据当时的宣传广告,这场大会将“以用户为中心”,面向“律师、医务人员、经济学家、政府工作者、工程师以及通信员等从业人员”[^4]。虽然大会的部分议题非常专业,比如《数据网络设计问题(一)》与《数据网络设计问题(二)》,但是正如宣传广告所承诺的,大部分会议的主要关注点还是计算机网络给经济社会带来的潜在影响。其中甚至有一场会议以惊人的先见之明探讨了如何积极利用法律制度“保护计算机数据库中的隐私权益” [^5]。
|
||||
|
||||
展示 ARPANET 的目的是作为与会者的一个附带景点。在国际宴会厅或酒店更下一层的其他地方举行的会议间歇,与会者可以自由进入<ruby>乔治敦宴会厅<rt>Georgetown Ballroom</rt></ruby>(在国际宴会厅走廊尽头的一个较小的宴会厅,也可以说是会议室)[^6],那里放置着用以访问 ARPANET 的 40 台由不同制造商生产的终端 [^7]。这些终端属于<ruby>哑终端<rt>dumb terminal</rt></ruby>,也就是说,只能用来输入命令、输出结果,本身无法进行计算。事实上,在 1972 年,所以这些终端可能都是<ruby>硬拷贝终端<rt>hardcopy terminal</rt></ruby>,即<ruby>电传打字机<rt>teletype machine</rt></ruby>。哑终端与一台被称为“<ruby>终端接口信息处理机<rt>Terminal Interface Message Processor</rt></ruby>”(TIP)的计算机相连接,后者放置在宴会厅中间的一个高台上。TIP 是早期的一种路由器,哑终端可通过 TIP 连接到 ARPANET。有了终端和 TIP,ICCC 与会者可以尝试登录和访问组成 ARPANET 的 29 个主机站的计算机 [^8]。
|
||||
|
||||
为了展示网络的性能,美国全国各主机站的研究员们通力合作,准备了 19 个简易的“情景”,供用户测试使用。他们还出了 [一份小册子][10],将这些情景收录其中。如果与会人员打算进入这个满是电线与哑终端的房间,就会得到这样一本小册子 [^9]。通过这些情景,研究员不仅要证明网络这项新技术的可行性,还要证明其实用性,因为 ARPANET 那时还只是“一条没有汽车驶过的公路”。此外,来自国防部的投资者们也希望,公开展示 ARPANET 可以进一步激发人们对网络的兴趣 [^10]。
|
||||
|
||||
因此,这些情景充分展示了在 ARPANET 网络上可以使用的软件的丰富性:有程序语言解释器,其中一个用于麻省理工学院(MIT)的 Lisp 语言,另一个用于加州大学洛杉矶分校的数值计算环境 Speakeasy;还有一些游戏,包括国际象棋和 <ruby>康威生命游戏<rt>Conway's Game of Life</rt></ruby>;以及几个也许最受与会者欢迎的人工智能聊天程序,包括由 MIT 的计算机科学家<ruby>约瑟夫·魏泽堡<rt>Joseph Weizenbaum</rt></ruby>开发的著名聊天程序<ruby>伊莉莎<rt>ELIZA</rt></ruby>。
|
||||
|
||||
设置这些情景的研究人员小心翼翼地列出了他们想让用户在终端机上输入的每一条命令。这点很重要,因为用于连接 ARPANET 主机的命令序列可能会因为主机的不同而发生变化。比如,为了能在 MIT 人工智能实验室的 PDP-10 微型电脑上测试人工智能国际象棋程序,与会者需要按照指示输入以下命令:
|
||||
|
||||
> 在下方代码块中,`[LF]`、`[SP]` 以及 `[CR]` 分别代表换行、空格以及回车键。我在每行的 `//` 符号后面都解释了当前一行命令的含义,不过当时的小册子本来是没有使用这一符号的。
|
||||
|
||||
```
|
||||
@r [LF] // 重置 TIP
|
||||
@e [SP] r [LF] // “远程回显”设置, 主机回显字符,TIP 不回显
|
||||
@L [SP] 134 [LF] // 连接 134 号主机
|
||||
:login [SP] iccXXX [CR] // 登录 MIT 人工智能实验室的系统,“XXX”代表用户名首字母缩写
|
||||
:chess [CR] // 启动国际象棋程序
|
||||
```
|
||||
|
||||
如果与会者输入了上述命令,那么他就可以体验当时最先进的国际象棋程序,其棋盘布局如下:
|
||||
|
||||
```
|
||||
BR BN BB BQ BK BB BN BR
|
||||
BP BP BP BP ** BP BP BP
|
||||
-- ** -- ** -- ** -- **
|
||||
** -- ** -- BP -- ** --
|
||||
-- ** -- ** WP ** -- **
|
||||
** -- ** -- ** -- ** --
|
||||
WP WP WP WP -- WP WP WP
|
||||
WR WN WB WQ WK WB WN WR
|
||||
```
|
||||
|
||||
与之不同的是,如果要连接加州大学洛杉矶分校的 IBM System/360 机器,运行 Speakeasy 数值计算环境,与会者需要输入以下命令:
|
||||
|
||||
```
|
||||
@r [LF] // 重置 TIP
|
||||
@t [SP] o [SP] L [LF] // “传递换行”设置
|
||||
@i [SP] L [LF] // “插入换行”设置,即回车时发送换行符。
|
||||
@L [SP] 65 [LF] // 连接 65 号主机
|
||||
tso // 连接 IBM 分时可选软件系统
|
||||
logon [SP] icX [CR] // 输入用户名,进行登录,“X”可为任意数字
|
||||
iccc [CR] // 输入密码(够安全!)
|
||||
speakez [CR] // 启动 Speakeasy
|
||||
```
|
||||
|
||||
输入上述命令后,与会者可以在终端中对矩阵进行乘法、转置以及其他运算,如下所示:
|
||||
|
||||
```
|
||||
:+! a=m*transpose(m);a [CR]
|
||||
:+! eigenvals(a) [CR]
|
||||
```
|
||||
|
||||
当时,这场演示给许多人都留下了深刻的印象,但原因并不是我们所想的那样,毕竟我们有的只是后见之明。今天的人们总是记不住,在 1972 年,即便身处两个不同的城市,远程登录使用计算机也已经不是一件新鲜事儿了。在那之前的数十年,电传打字机就已经用于与相隔很远的计算机传递信息了。在 ICCC 第一届大会之前,差不多整整五年前,在西雅图的一所高中,<ruby>比尔·盖茨<rt>Bill Gates</rt></ruby>使用电传打字机,在该市其他地方的<ruby>通用电气<rt>General Electric</rt></ruby>(GE)计算机上运行了他的第一个 BASIC 程序。在当时,登录远程计算机,运行几行命令或者玩一些文字游戏,只不过是家常便饭。因此,虽说上文提到的软件的确很不错,但是即便没有 ARPANET,我刚刚介绍的两个情景勉强也是可以实现的。
|
||||
|
||||
当然,ARPANET 一定带来了新的东西。参加本次大会的律师、政治家与经济学家可能被国际象棋游戏与聊天机器人所吸引,但是网络专家们可能对另外两个情景更感兴趣,因为它们将 ARPANET 的作用更好地展示了出来。
|
||||
|
||||
在其中一个情景下,MIT <ruby>非兼容分时系统<rt>Incompatible Timesharing System</rt></ruby>(ITS)上运行了一个名为 `NETWRK` 的程序。`NETWRK` 命令下有若干个子命令,输入这些子命令就能得到 ARPANET 各方面的运行状态。`SURVEY` 子命令可以列出 ARPANET 上哪些主机正在运行和可用(它们都在一个列表中);`SUMMARY.OF.SURVEY` 子命令汇总了过去 `SURVEY` 子命令过去的运行结果,得出每台主机的“正常运行比率”,以及每台主机响应消息的平均时间。`SUMMARY.OF.SURVEY` 子命令以表格的形式输出结果,如下所示:
|
||||
|
||||
```
|
||||
--HOST-- -#- -%-UP- -RESP-
|
||||
UCLA-NMC 001 097% 00.80
|
||||
SRI-ARC 002 068% 01.23
|
||||
UCSB-75 003 059% 00.63
|
||||
...
|
||||
```
|
||||
|
||||
可以看到,主机编号的占位不超过三个数字(哈!)。其他 `NETWRK` 子命令能够查看较长时间内查询结果的概要,或者检查单个主机查询结果的日志。
|
||||
|
||||
第二个情景用到了斯坦福大学开发的一款软件 —— SRI-ARC 联机系统。这款软件功能齐全,非常优秀。美国发明家<ruby>道格拉斯·恩格尔巴特<rt>Douglas Engelbart</rt></ruby>在 “<ruby>所有演示之母<rt>Mother of All Demos</rt></ruby>” 上演示的正是 SRI-ARC 联机系统。这款软件可以在加州大学圣芭芭拉分校的主机上运行本质上属于文件托管的服务。使用华盛顿希尔顿酒店的终端,用户可以将斯坦福大学主机上创建的文件复制到加州大学圣芭芭拉分校的主机上。操作也很简单,只需执行 `copy` 命令,然后回答计算机的下列问题:
|
||||
|
||||
> 在下方的代码块中,`[ESC]`、`[SP]` 与 `[CR]` 分别代表退出、空格与回车键;圆括号中的文字是计算机打印出的提示信息;第三行中的退出键用于自动补全文件名。此处复制的文件是 `<system>sample.txt;1`,其中文件名末尾的数字 1 代表文件的版本号,`<system>` 表示文件路径。这种文件名是 TENEX 操作系统上面的惯用写法。[^11]
|
||||
|
||||
```
|
||||
@copy
|
||||
(TO/FROM UCSB) to
|
||||
(FILE) <system>sample [ESC] .TXT;1 [CR]
|
||||
(CREATE/REPLACE) create
|
||||
```
|
||||
|
||||
这两个情景看起来好像和最初提及的两个情景没有太大区别,但是此二者却意义非凡。因为它们证明了,在 ARPANET 上面,不仅人们可以与计算机进行交流,计算机与计算机也可以 _相互_ 交流。MIT 主机上的 `SURVEY` 命令的结果并非由人类定期登录并检查每台机器的运行状态收集而来,而是由一款能在网络上与其他机器进行交流的软件收集得到的。同样的道理,在斯坦福大学与加州大学圣芭芭拉分校之间传输文件的情景下,也没有人守在两所大学的终端旁边,华盛顿特区的终端用户仅仅使用了一款软件,就能让其他两地的计算机相互对话。更重要的是,这一点无关乎你使用的是宴会厅里的哪一台电脑,因为只要输入同样的命令序列,就能在任意一台电脑上浏览 MIT 的网络监视数据,或者在加州大学圣芭芭拉分校的计算机上储存文件。
|
||||
|
||||
这才是 ARPANET 的全新之处。本次国际计算机通信会议演示的不仅仅是人与远程电脑之间的交互,也不仅仅是远程输入输出的操作,更是一个软件与其他软件之间的远程通讯,这一点才是史无前例的。
|
||||
|
||||
为什么这一点才是最重要的,而不是地图上画着的那些贯穿整个美国、实际连接起来的电线呢(这些线是租赁的电话线,而且它们以前就在那了!)?要知道,早在 1966 年 ARPANET 项目启动之前,美国国防部的高级研究计划署(ARPA)打造了一间终端室,里面有三台终端。三台终端分别连接着位于 MIT、加州大学伯克利分校以及圣塔莫尼卡三地的计算机 [^12]。对于 ARPA 的工作人员来说,即便他们身处华盛顿特区,使用这三台计算机也非常方便。不过,这其中也有不便之处:工作人员必须购买和维护来自三家不同制造商的终端,牢记三种不同的登录步骤,熟悉三种不同的计算环境。虽然这三台终端机可能就放在一起,但是它们只是电线另一端主机系统的延申,而且操作也和那些计算机一样各不相同。所以说,在 ARPANET 项目诞生之前,远程连接计算机进行通讯就已经实现了,但问题是不同的计算系统阻碍了通讯朝着更加先进复杂的方向发展。
|
||||
|
||||
### 集合起来,就在此刻
|
||||
|
||||
因此,我想说的是,说法一(ARPANET 首次通过计算机将不同地方的人们连接了起来)与说法二(ARPANET 首次将多个计算机系统彼此连接了起来)之间有着云泥之别。听起来似乎有些吹毛求疵,咬文嚼字,但是相较于说法二,说法一忽略了一些重要的历史发展阶段。
|
||||
|
||||
首先,历史学家<ruby>乔伊·利西·兰金<rt>Joy Lisi Rankin</rt></ruby>指出,早在 ARPANET 诞生之前,人们就已经在网络空间中进行交流了。在《<ruby>美国计算机的人民历史<rt>A People’s History of Computing in the United States</rt></ruby>》一书中,兰金介绍了几个覆盖全美的数字社区,这些社区运行在早于 ARPANET 的<ruby>分时网络<rt>time-sharing network</rt></ruby>上面。从技术层面讲,分时网络并不是计算机网络,因为它仅仅由一台大型主机构成。这种计算机放置在地下室中,为多台哑终端提供计算,颇像一只又黑又胖的奇怪生物,触手向外伸展着,遍及整个美国。不过,在分时网络时代,被后社交媒体时代称为“网络”的大部分社会行为应有尽有。例如,Kiewit 网络是<ruby>达特茅斯分时系统<rt>Dartmouth Time-Sharing System</rt></ruby>的延伸应用,服务于美国东北部的各个大学和高中。在 Kiewit 网络上,高中生们共同维护着一个“<ruby>八卦档案<rt>gossip file</rt></ruby>”,用来记录其他学校发生的趣闻趣事,“在康涅狄格州和缅因州之间建立起了社交联系” [^13]。同时,曼荷莲女子学院的女生通过网络与达特茅斯学院的男生进行交流,或者是安排约会,或者是与男朋友保持联系 [^14]。这些事实都发生在上世纪六十年代。兰金认为,如果忽视了早期的分时网络,我们对美国过去 50 年数字文化发展的认识必然是贫瘠的:我们眼里可能只有所谓的“<ruby>硅谷神话<rt>Silicon Valley mythology</rt></ruby>”,认为计算机领域的所有发展都要归功于少数的几位天才,或者说互联网科技巨头的创始人。
|
||||
|
||||
回到 ARPANET,如果我们能意识到真正的困难是计算机 _系统_ 的联通,而非机器本身的物理连接,那么在探讨 ARPANET 的创新点时,我们就会更加倾向于第二种说法。ARPANET 是有史以来第一个<ruby>分组交换网络<rt>packet-switched network</rt></ruby>,涉及到许多重要的技术应用。但是如果仅仅因为这项优势,就说它是一项突破,我觉得这种说法本身就是错的。ARPANET 旨在促进全美计算机科学家之间的合作,目的是要弄明白不同的操作系统、不同语言编写的软件如何配合使用,而非如何在麻省和加州之间实现高效的数据传输。因此,ARPANET 不仅是第一个分组交换网络,它还是一项非常成功且优秀的标准。在我看来,后者更有意思,毕竟我在博客上曾经写过许多颇有失败的标准:[语义网][17]、[RSS][18] 与 [FOAF][19]。
|
||||
|
||||
ARPANET 项目初期没有考虑到网络协议,协议的制定是后来的事情了。因此,这项工作自然落到了主要由研究生组成的组织 —— <ruby>网络工作组<rt>Network Working Group</rt></ruby>(NWG)身上。该组织的首次会议于 1968 年在加州大学圣芭芭拉分校举办 [^15]。当时只有 12 人参会,大部分都是来自上述四所大学的代表 [^16]。来自加州大学洛杉矶分校的研究生<ruby>史蒂夫·克罗克<rt>Steve Crocker</rt></ruby>参加了这场会议。他告诉我,工作组首次会议的参会者清一色都是年轻人,最年长的可能要数会议主席<ruby>埃尔默·夏皮罗<rt>Elmer Shapiro</rt></ruby>了,他当年 38 岁左右。ARPA 没有派人负责研究计算机连接之后如何进行通信,但是很明显它需要提供一定的协助。随着工作组会议的陆续开展,克罗克一直期望着更有经验与威望的“法定成年人”从东海岸飞过来接手这项工作,但是期望终究还是落空了。在 ARPA 的默许之下,工作组举办了多场会议,其中包括很多长途旅行,差旅费由 ARPA 报销,这些就是它给与工作组的全部协助了 [^17]。
|
||||
|
||||
当时,网络工作组面临着巨大的挑战。从没有人有过使用通用方式连接计算机系统的经验,而且这本来就与上世纪六十年代末计算机领域盛行的全部观点相悖:
|
||||
|
||||
> 那个时候典型的主机表现得就像是它是全宇宙唯一的计算机。即便是最简短的交流会话,两台主机也无法轻易做到。并不是说机器没办法相互连接,只是连接之后,两台计算机又能做些什么呢?当时,计算机和与其相连的其他设备之间的通讯,就像帝王与群臣之间的对话一般。连接到主机的设备各自执行着自己的任务,每台外围设备都保持着常备不懈的状态,等待着上司的命令。当时的计算机就是严格按照这类互动需求设计出来的;它们向读卡器、终端与磁带机等下属设备发号施令,发起所有会话。但是,如果一台计算机拍了拍另一台计算机的肩膀,说道,“你好,我也是一台计算机”,那么另一台计算机可就傻眼了,什么也回答不上来 [^18]。
|
||||
|
||||
于是,工作组的最初进展很缓慢 [^19]。直到 1970 年 6 月,也就是首次会议将近两年之后,工作组才为网络协议选定了一套“正式”规范 [^20]。
|
||||
|
||||
不过,到了 1972 年,在国际计算机通信会议上展示 ARPANET 的时候,所有的协议已经准备就绪了。会议期间,这些协议运用到了国际象棋等情景之中。用户运行 `@e r` 命令(`@echo remote` 命令的缩写形式),可以指示 TIP 使用新 TELNET 虚拟终端协议提供的服务,通知远程主机它应该回显用户输入的内容。接着,用户运行 `@L 134` 命令(`@login 134` 命令的缩写形式),让 TIP 在 134 号主机上调用<ruby>初始连接协议<rt>Initial Connection Protocol</rt></ruby>,该协议指示远程主机分配出连接所需的全部必要资源,并将用户带入 TELNET 会话中。上述文件传输的情景也许用到了 <ruby>文件传输协议<rt>File Transfer Protocol</rt></ruby>(FTP),而该协议恰好是在大会举办前夕才刚刚完成的 [^21]。所有这些协议都是“三层”协议,其下的第二层是主机到主机的协议,定义了主机之间可以相互发送和接收的信息的基本格式;第一层是主机到接口通信处理机(IMP)的协议,定义了主机如何与连接的远程设备进行通信。令人感到不可思议的是,这些协议都能正常运行。
|
||||
|
||||
在我看来,网络工作组之所以能够在大会举办之前做好万全的准备,顺利且出色地完成任务,在于他们采用了开放且非正式的标准化方法,其中一个典型的例子就是著名的 <ruby>征求意见<rt>Request for Comments</rt></ruby>(RFC)系列文档。RFC 文档最初通过<ruby>传统信件<rt>snail mail</rt></ruby>在工作组成员之间进行传阅,让成员们在没有举办会议的时候也能保持联系,同时收集成员反馈,汇集各方智慧。RFC 框架是克罗克提出的,他写出了第一篇 RFC 文档,并在早期负责管理 RFC 的邮寄列表。他这样做是为了强调工作组开放协作的活动本质。有了这套框架以及触手可及的文档,ARPANET 的协议设计过程成了一个大熔炉,每个人都可以贡献出自己的力量,步步推进,精益求精,让最棒的想法脱颖而出,而没有人失去面子。总而言之,RFC 获得了巨大成功,并且直至今天,长达半个世纪之后,它依旧是网络标准的“说明书”。
|
||||
|
||||
因此,说起 ARPANET 的影响力,我认为不得不强调的一点正是工作组留下的这一成果。今天,互联网可以把世界各地的人们连接起来,这也是它最神奇的属性之一。不过如果说这项技术到了上世纪才开始使用,那可就有些滑稽可笑了。要知道,在 ARPANET 出现之前,人们就已经通过电报打破了现实距离的限制。而 ARPANET 打破的应该是各个主机站因使用不同的操作系统、字符编码、程序语言以及组织策略而在逻辑层面产生的差异限制。当然,将第一个分组交换网络投入使用在技术方面绝对是一大壮举,这肯定值得一提,不过,制定统一的标准并用以连接原本无法相互协作的计算机,是建立 ARPANET 网络过程中遇到的这两大难题中更为复杂的一个。而这一难题的解决方案,也成了 ARPANET 整个建立与发展历史中最为神奇的一个章节。
|
||||
|
||||
1981 年,高级研究计划署发表了一份“完工报告”,回顾了 ARPANET 项目的第一个十年。在《付出收获了回报的技术方面以及付出未能实现最初设想的技术方面》这一冗长的小标题下,作者们写道:
|
||||
|
||||
> 或许,在 ARPANET 的开发过程中,最艰难的一项任务就是,尽管主机制造商各不相同,或者同一制造商下操作系统各不相同,我们仍需在众多的独立主机系统之间实现通讯交流。好在这项任务后来取得了成功 [^22]。
|
||||
|
||||
你可以从美国联邦政府获得相关信息。
|
||||
|
||||
_如果你喜欢这篇文章,欢迎关注推特 [@TwoBitHistory][28],也可通过 [RSS 馈送][29] 订阅,获取最新文章。_
|
||||
|
||||
[^1]: “Hilton Hotel Opens in Capital Today.” _The New York Times_, 20 March 1965, <https://www.nytimes.com/1965/03/20/archives/hilton-hotel-opens-in-capital-today.html?searchResultPosition=1>. Accessed 7 Feb. 2021.
|
||||
[^2]: James Pelkey. _Entrepreneurial Capitalism and Innovation: A History of Computer Communications 1968-1988,_ Chapter 4, Section 12, 2007, <http://www.historyofcomputercommunications.info/Book/4/4.12-ICCC%20Demonstration71-72.html>. Accessed 7 Feb. 2021.
|
||||
[^3]: Katie Hafner and Matthew Lyon. _Where Wizards Stay Up Late: The Origins of the Internet_. New York, Simon & Schuster, 1996, p. 178.
|
||||
[^4]: “International Conference on Computer Communication.” _Computer_, vol. 5, no. 4, 1972, p. c2, <https://www.computer.org/csdl/magazine/co/1972/04/01641562/13rRUxNmPIA>. Accessed 7 Feb. 2021.
|
||||
[^5]: “Program for the International Conference on Computer Communication.” _The Papers of Clay T. Whitehead_, Box 42, <https://d3so5znv45ku4h.cloudfront.net/Box+042/013_Speech-International+Conference+on+Computer+Communications,+Washington,+DC,+October+24,+1972.pdf>. Accessed 7 Feb. 2021.
|
||||
[^6]: 我其实并不清楚 ARPANET 是在哪个房间展示的。很多地方都提到了“宴会厅”,但是华盛顿希尔顿酒店更习惯于叫它“乔治敦”,而不是把它当成一间会议室。因此,或许这场展示是在国际宴会厅举办的。但是 RFC 372 号文件又提到了预定“乔治敦”作为展示场地一事。华盛顿希尔顿酒店的楼层平面图可以点击 [此处][36] 查看。
|
||||
[^7]: Hafner, p. 179.
|
||||
[^8]: ibid., p. 178.
|
||||
[^9]: Bob Metcalfe. “Scenarios for Using the ARPANET.” _Collections-Computer History Museum_, <https://www.computerhistory.org/collections/catalog/102784024>. Accessed 7 Feb. 2021.
|
||||
[^10]: Hafner, p. 176.
|
||||
[^11]: Robert H. Thomas. “Planning for ACCAT Remote Site Operations.” BBN Report No. 3677, October 1977, <https://apps.dtic.mil/sti/pdfs/ADA046366.pdf>. Accessed 7 Feb. 2021.
|
||||
[^12]: Hafner, p. 12.
|
||||
[^13]: Joy Lisi Rankin. _A People’s History of Computing in the United States_. Cambridge, MA, Harvard University Press, 2018, p. 84.
|
||||
[^14]: Rankin, p. 93.
|
||||
[^15]: Steve Crocker. Personal interview. 17 Dec. 2020.
|
||||
[^16]: 克罗克将会议记录文件发给了我,文件列出了所有的参会者。
|
||||
[^17]: Steve Crocker. Personal interview.
|
||||
[^18]: Hafner, p. 146.
|
||||
[^19]: “Completion Report / A History of the ARPANET: The First Decade.” BBN Report No. 4799, April 1981, <https://walden-family.com/bbn/arpanet-completion-report.pdf>, p. II-13.
|
||||
[^20]: 这里我指的是 RFC 54 号文件中的“正式协议”。
|
||||
[^21]: Hafner, p. 175.
|
||||
[^22]: “Completion Report / A History of the ARPANET: The First Decade,” p. II-29.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2021/02/07/arpanet.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[aREversez](https://github.com/aREversez)
|
||||
校对:[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://en.wikipedia.org/wiki/ARPANET
|
||||
[10]: https://archive.computerhistory.org/resources/access/text/2019/07/102784024-05-001-acc.pdf
|
||||
[17]: https://twobithistory.org/2018/05/27/semantic-web.html
|
||||
[18]: https://twobithistory.org/2018/12/18/rss.html
|
||||
[19]: https://twobithistory.org/2020/01/05/foaf.html
|
||||
[28]: https://twitter.com/TwoBitHistory
|
||||
[29]: https://twobithistory.org/feed.xml
|
||||
[30]: https://twitter.com/TwoBitHistory/status/1277259930555363329?ref_src=twsrc%5Etfw
|
||||
[36]: https://www3.hilton.com/resources/media/hi/DCAWHHH/en_US/pdf/DCAWH.Floorplans.Apr25.pdf
|
125
published/20210602 New ways to learn about open organizations.md
Normal file
125
published/20210602 New ways to learn about open organizations.md
Normal file
@ -0,0 +1,125 @@
|
||||
[#]: subject: (New ways to learn about open organizations)
|
||||
[#]: via: (https://opensource.com/open-organization/21/6/celebrate-sixth-anniversary)
|
||||
[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MareDevi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-15133-1.html)
|
||||
|
||||
了解开放组织的新途径
|
||||
======
|
||||
|
||||
> 通过参与两个令人兴奋的新项目来庆祝开放组织社区的六周年。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/12/143419tx8nrr51v8x6r515.jpg)
|
||||
|
||||
2021 年 6 月 2 日,<ruby>开放组织<rt>Open Organization</rt></ruby>社区庆祝其成立六周年。这是六年来([上百篇的][2])文章、([一系列的][3])书籍、([具有启发性的][4])对话、(我们所 [喜欢的][5])教学和学习。我们非常自豪地成为一个充满活力的开放专家和领导者的社区,致力于将 [开放原则][6] 带到大大小小的组织。事实上,许多 <ruby>[开放组织大使][7]<rt>Open Organization Ambassadors</rt></ruby> 以帮助他人变得更加开放为职业,我们的社区仍然致力于帮助各行业的领导者以开放的心态和行为融入他们的社区和环境中。
|
||||
|
||||
[去年][8] 是开放组织项目的一个 [成长][9] 和 [发展][10] 时期。今年,我们将在这一势头的基础上继续努力。今天,我们很自豪地介绍两项新的倡议——当然,也邀请你的参加。
|
||||
|
||||
### 开启,调整,开放
|
||||
|
||||
首先,我们很高兴地宣布:我们社区的工作有了一个全新的场所。[OpenOrgTV][11]。这不仅仅是一个新的平台。它也是另一种媒介的实验:视频。
|
||||
|
||||
在我们的频道上,我们将举办各种对话 —— 从深层次的书评到社区圆桌会议。首先,请查看“<ruby>[开放领导力对话][12]<rt>Open Leadership Conversations</rt></ruby>”系列,其中包括对某些富有洞察力的领导者的采访,提供他们对根据开放原则进行领导的意义的观点。或者观看我们的 Q&A 式写作节目 “<ruby>[问大使][13]<rt>Ask the Ambassadors</rt></ruby>”,由社区专家回答你关于组织文化和设计的问题。也想参与这个节目吗?在我们的 [新的专门的论坛][14] 中向社区成员提交你的问题。
|
||||
|
||||
整个月,我们都会介绍 <ruby>[开放组织大使][15]<rt>Open Organization Ambassadors</rt></ruby>,让你终于可以看到他们的面孔,并听到你多年来阅读的故事、案例研究和采访背后的声音。
|
||||
|
||||
### 定义开放领导力
|
||||
|
||||
自从我们几年前发布它以来,<ruby>[开放组织定义][16]<rt>Open Organization Definition</rt></ruby> 已成为更好地理解开放组织文化和设计本质的组织指导框架(并且我们已经做了很多工作来 [教导其他人][17])。随着时间的推移,我们甚至开发了 [一个成熟度模型][18] 来操作该定义,因此组织可以评估自己的开放程度并制定具体计划以变得 _更加_ 开放。
|
||||
|
||||
现在,我们认为是时候将这项工作更进一步了。
|
||||
|
||||
但是,开放组织社区不仅仅是平台、工具或项目的任何组合。它是所有人都热情地一起工作,以帮助传播开放原则和实践。
|
||||
|
||||
受我们自己经验、[红帽][19] 和 [Mozilla][20] 等开放组织已有的框架、多年研究和采访该领域的开放领袖的启发,以及我们对更好地理解开放领导力如何 _真正_ 发挥作用的渴望,我们很高兴公布一份全新文件的早期草案:<ruby>开放领导力定义<rt>Open Leadership Definition</rt></ruby>。
|
||||
|
||||
本文档概述了建立开放型组织,并使其成为思想开放的人能够成长和茁壮成长的地方的各类领导者所特有的心态和行为。它建立在<ruby>开放领导力定义<rt>Open Leadership Definition</rt></ruby>的基础上,解释了开放型领导者如何体现和倡导开放型组织的特征,如透明度、包容性、适应性、协作性和社区性。
|
||||
|
||||
而且我们渴望与世界分享。
|
||||
|
||||
从今天开始(在接下来的两周内),我们将收集你对我们文件草案的见解和意见。我们渴望听到你的想法,并将接受你的意见的 _整体_ 或片段。你可以对文件的个别部分或整个文件提出意见。请查看下面的链接。我们期待着听到你的意见。
|
||||
|
||||
![Open Leadership Definition word cloud][21]
|
||||
|
||||
*Laura Hiliger 提供的开放领导力定义词云 (CC BY-SA)*
|
||||
|
||||
#### 开放领导力定义
|
||||
|
||||
- [开放领导力定义:简介][22]
|
||||
- [开放领导力定义:透明度][23]
|
||||
- [开放领导力定义:包容性][24]
|
||||
- [开放领导力定义:适应性][25]
|
||||
- [开放领导力定义:协作][26]
|
||||
- [开放领导力定义:社区][27]
|
||||
|
||||
在我们的共享文件夹中 [阅读全文][28]。
|
||||
|
||||
### 联系我们
|
||||
|
||||
当然,你仍然可以在所有常见的地方找到我们的社区,如:
|
||||
|
||||
* [我们的项目网站][29],你通往整个开放组织项目和社区的门户。
|
||||
* [我们的对话中心][4],在这里你可以与社区成员互动,提出问题,了解新项目,寻找资源,并帮助他人。
|
||||
* [我们的 GitHub 组织][30],我们一直在公开研究新项目,并邀请你加入我们
|
||||
* [我们在 Opensource.com 的发表频道][2],我们在这里为各地区和各行业的从业人员发布最新的分析、案例研究、访谈和资源。
|
||||
* 我们的 [Twitter][31] 和 [LinkedIn][32] 平台,我们将在这里分享我们的最新进展,并促进新的对话。
|
||||
|
||||
但开放组织社区不仅仅是平台、工具或项目的任何组合。 是 _人_,所有人都热情地一起工作以帮助传播开放的原则和实践。正是这些人使我们的社区如此伟大。
|
||||
|
||||
六年来一直如此,并将永远保持下去。
|
||||
|
||||
### 从数字上看
|
||||
|
||||
![][33]
|
||||
|
||||
*Jen Kelchner 提供的信息图*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/21/6/celebrate-sixth-anniversary
|
||||
|
||||
作者:[Laura Hilliger][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MareDevi](https://github.com/MareDevi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/laurahilliger
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openorg_sixth_anniversary.png?itok=3RWyEk5S
|
||||
[2]: https://opensource.com/open-organization
|
||||
[3]: https://theopenorganization.org/books
|
||||
[4]: https://www.theopenorganization.community/
|
||||
[5]: https://www.youtube.com/watch?v=Snf6vICDbzw&list=PLLIYDJHuxOkaPEH76mIJe-HHplsiSAVej
|
||||
[6]: https://theopenorganization.org/definition
|
||||
[7]: https://theopenorganization.org/about
|
||||
[8]: https://opensource.com/open-organization/20/6/scaling-energetic-community
|
||||
[9]: https://opensource.com/open-organization/20/7/evolving-project-governance
|
||||
[10]: https://opensource.com/open-organization/20/8/open-community-rebrands
|
||||
[11]: http://theopenorganization.tv
|
||||
[12]: https://www.youtube.com/watch?v=07YBs0ss9rU&list=PLLIYDJHuxOkYDTLbKRjcd9THTFtpnK8lh
|
||||
[13]: https://www.youtube.com/watch?v=ukkZMYqRuUQ&list=PLLIYDJHuxOkY1gDbOFLDxGxwwmxeOATrI
|
||||
[14]: https://www.theopenorganization.community/c/ask-community/19
|
||||
[15]: http://theopenorganization.org/roster/
|
||||
[16]: https://theopenorganization.org/definition/
|
||||
[17]: https://youtu.be/NYngFYGgxro
|
||||
[18]: https://github.com/open-organization/open-org-maturity-model
|
||||
[19]: https://github.com/red-hat-people-team/red-hat-multiplier
|
||||
[20]: https://mozilla.github.io/open-leadership-framework/framework/#the-open-leadership-framework
|
||||
[21]: https://opensource.com/sites/default/files/images/open-org/open_leadership_word_cloud.png (Open Leadership Definition word cloud)
|
||||
[22]: https://docs.google.com/document/d/1blmf94ED_p4BHGv0luU_XrU26aF7tCzV6WTmh_v-PDY/edit?usp=sharing
|
||||
[23]: https://docs.google.com/document/d/14ssBBL0h2vxU0WZoMnWs6eo_8oRfJhnAr5yr-fAiLGU/edit?usp=sharing
|
||||
[24]: https://docs.google.com/document/d/1lRutADes5E0mcwtc6GR_Qw06PuJLc9-wUK5W1Gcf_BA/edit?usp=sharing
|
||||
[25]: https://docs.google.com/document/d/1RcwWTpkT42bgkf6EPiECt8LyAJ1XZjNGhzk0cQuBB7c/edit?usp=sharing
|
||||
[26]: https://docs.google.com/document/d/1hTvnpqQkOc76-0UJbV6tAvRxOE--bdt96mqGmAKGqiI/edit?usp=sharing
|
||||
[27]: https://docs.google.com/document/d/1Zl1smi-4jDZNNWd0oNY8qRH-GDi9q5VfvgyZ7YLkvm4/edit?usp=sharing
|
||||
[28]: https://drive.google.com/drive/folders/1e1N_0p5lJEwAo_s6hQ3OK0KaJIfc7fgF?usp=sharing
|
||||
[29]: http://theopenorganization.org/
|
||||
[30]: https://github.com/open-organization
|
||||
[31]: https://twitter.com/openorgproject
|
||||
[32]: https://www.linkedin.com/company/the-open-organization/
|
||||
[33]: https://opensource.com/sites/default/files/images/open-org/openorgproject_6_anniversary_stats.png
|
184
published/20210721 Write your first web component.md
Normal file
184
published/20210721 Write your first web component.md
Normal file
@ -0,0 +1,184 @@
|
||||
[#]: subject: (Write your first web component)
|
||||
[#]: via: (https://opensource.com/article/21/7/web-components)
|
||||
[#]: author: (Ramakrishna Pattnaik https://opensource.com/users/rkpattnaik780)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (cool-summer-021)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-15148-1.html)
|
||||
|
||||
开发你的第一个 Web 组件
|
||||
======
|
||||
|
||||
> 不要做重复的工作;基于浏览器开发 Web App 时,需要制作一些可重用的模块。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/17/101134uzsiis8xsu9wqibi.jpg)
|
||||
|
||||
Web 组件是一系列开源技术(例如 JavaScript 和 HTML)的集合,你可以用它们创建一些 Web App 中可重用的自定义元素。你创建的组件是独立于其他代码的,所以这些组件可以方便地在多个项目中重用。
|
||||
|
||||
首先,它是一个平台标准,所有主流的浏览器都支持它。
|
||||
|
||||
### Web 组件中包含什么?
|
||||
|
||||
* **定制元素**:JavaScript API 支持定义 HTML 元素的新类别。
|
||||
* **影子 DOM**:JavaScript API 提供了一种将一个隐藏的、独立的 [文档对象模型][2](DOM)附加到一个元素的方法。它通过保留从页面的其他代码分离出来的样式、标记结构和行为特征对 Web 组件进行了封装。它会确保 Web 组件内样式不会被外部样式覆盖,反之亦然,Web 组件内样式也不会“泄露”到页面的其他部分。
|
||||
* **HTML 模板**:该元素支持定义可重用的 DOM 元素。可重用 DOM 元素和它的内容不会呈现在 DOM 内,但仍然可以通过 JavaScript 被引用。
|
||||
|
||||
### 开发你的第一个 Web 组件
|
||||
|
||||
你可以借助你最喜欢的文本编辑器和 JavaScript 写一个简单的 Web 组件。本指南使用 Bootstrap 生成简单的样式,并创建一个简易的卡片式的 Web 组件,给定了位置信息,该组件就能显示该位置的温度。该组件使用了 [Open Weather API][3],你需要先注册,然后创建 APPID/APIKey,才能正常使用。
|
||||
|
||||
调用该组件,需要给出位置的经度和纬度:
|
||||
|
||||
```
|
||||
<weather-card longitude='85.8245' latitude='20.296' />
|
||||
```
|
||||
|
||||
创建一个名为 `weather-card.js` 的文件,这个文件包含 Web 组件的所有代码。首先,需要定义你的组件,创建一个模板元素,并在其中加入一些简单的 HTML 标签:
|
||||
|
||||
```
|
||||
const template = document.createElement('template');
|
||||
|
||||
template.innerHTML = `
|
||||
<div class="card">
|
||||
<div class="card-body"></div>
|
||||
</div>
|
||||
`
|
||||
```
|
||||
|
||||
定义 Web 组件的类及其构造函数:
|
||||
|
||||
```
|
||||
class WeatherCard extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this._shadowRoot = this.attachShadow({ 'mode': 'open' });
|
||||
this._shadowRoot.appendChild(template.content.cloneNode(true));
|
||||
}
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
构造函数中,附加了 `shadowRoot` 属性,并将它设置为开启模式。然后这个模板就包含了 shadowRoot 属性。
|
||||
|
||||
接着,编写获取属性的函数。对于经度和纬度,你需要向 Open Weather API 发送 GET 请求。这些功能需要在 `connectedCallback` 函数中完成。你可以使用 `getAttribute` 方法访问相应的属性,或定义读取属性的方法,把它们绑定到本对象中。
|
||||
|
||||
```
|
||||
get longitude() {
|
||||
return this.getAttribute('longitude');
|
||||
}
|
||||
|
||||
get latitude() {
|
||||
return this.getAttribute('latitude');
|
||||
}
|
||||
```
|
||||
|
||||
现在定义 `connectedCallBack` 方法,它的功能是在需要时获取天气数据:
|
||||
|
||||
```
|
||||
connectedCallback() {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
const url = `http://api.openweathermap.org/data/2.5/weather?lat=${this.latitude}&lon=${this.longitude}&appid=API_KEY`
|
||||
xmlHttp.open("GET", url, false);
|
||||
xmlHttp.send(null);
|
||||
this.$card = this._shadowRoot.querySelector('.card-body');
|
||||
let responseObj = JSON.parse(xmlHttp.responseText);
|
||||
let $townName = document.createElement('p');
|
||||
$townName.innerHTML = `Town: ${responseObj.name}`;
|
||||
this._shadowRoot.appendChild($townName);
|
||||
let $temperature = document.createElement('p');
|
||||
$temperature.innerHTML = `${parseInt(responseObj.main.temp - 273)} °C`
|
||||
this._shadowRoot.appendChild($temperature);
|
||||
}
|
||||
```
|
||||
|
||||
一旦获取到天气数据,附加的 HTML 元素就添加进了模板。至此,完成了类的定义。
|
||||
|
||||
最后,使用 `window.customElements.define` 方法定义并注册一个新的自定义元素:
|
||||
|
||||
```
|
||||
window.customElements.define('weather-card', WeatherCard);
|
||||
```
|
||||
|
||||
其中,第一个参数是自定义元素的名称,第二个参数是所定义的类。这里是 [整个组件代码的链接][5]。
|
||||
|
||||
你的第一个 Web 组件的代码已完成!现在应该把它放入 DOM。为了把它放入 DOM,你需要在 HTML 文件(`index.html`)中载入指向 Web 组件的 JavaScript 脚本。
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<weather-card longitude='85.8245' latitude='20.296'/>
|
||||
<script src='./weather-card.js'></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
```
|
||||
|
||||
这就是显示在浏览器中的 Web 组件:
|
||||
|
||||
![Web component displayed in a browser][6]
|
||||
|
||||
由于 Web 组件中只包含 HTML、CSS 和 JavaScript,它们本来就是浏览器所支持的,并且可以无瑕疵地跟前端框架(例如 React 和 Vue)一同使用。下面这段简单的代码展现的是它跟一个由 [Create React App][8] 引导的一个简单的 React App 的整合方法。如果你需要,可以引入前面定义的 `weather-card.js`,把它作为一个组件使用:
|
||||
|
||||
```
|
||||
import './App.css';
|
||||
import './weather-card';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<weather-card longitude='85.8245' latitude='20.296'></weather-card>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
### Web 组件的生命周期
|
||||
|
||||
一切组件都遵循从初始化到移除的生命周期法则。每个生命周期事件都有相应的方法,你可以借助这些方法令组件更好地工作。Web 组件的生命周期事件包括:
|
||||
|
||||
* `Constructor`:Web 组件的构造函数在它被挂载前调用,意味着在元素附加到文档对象前被创建。它用于初始化本地状态、绑定事件处理器以及创建影子 DOM。在构造函数中,必须调用 `super()`,执行父类的构造函数。
|
||||
* `ConnectedCallBack`:当一个元素被挂载(即,插入 DOM 树)时调用。该函数处理创建 DOM 节点的初始化过程中的相关事宜,大多数情况下用于类似于网络请求的操作。React 开发者可以将它与 `componentDidMount` 相关联。
|
||||
* `attributeChangedCallback`:这个方法接收三个参数:`name`, `oldValue` 和 `newValue`。组件的任一属性发生变化,就会执行这个方法。属性由静态 `observedAttributes` 方法声明:
|
||||
```
|
||||
static get observedAttributes() {
|
||||
return ['name', '_id'];
|
||||
}
|
||||
```
|
||||
一旦属性名或 `_id` 改变,就会调用 `attributeChangedCallback` 方法。
|
||||
* `DisconnectedCallBack`:当一个元素从 DOM 树移除,会执行这个方法。它相当于 React 中的 `componentWillUnmount`。它可以用于释放不能由垃圾回收机制自动清除的资源,比如 DOM 事件的取消订阅、停用计时器或取消所有已注册的回调方法。
|
||||
* `AdoptedCallback`:每次自定义元素移动到一个新文档时调用。只有在处理 IFrame 时会发生这种情况。
|
||||
|
||||
### 模块化开源
|
||||
|
||||
Web 组件对于开发 Web App 很有用。无论你是熟练使用 JavaScript 的老手,还是初学者,无论你的目标客户使用哪种浏览器,借助这种开源标准创建可重用的代码都是一件可以轻松完成的事。
|
||||
|
||||
*插图:Ramakrishna Pattnaik, [CC BY-SA 4.0][7]*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/web-components
|
||||
|
||||
作者:[Ramakrishna Pattnaik][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://opensource.com/users/rkpattnaik780
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet)
|
||||
[2]: https://en.wikipedia.org/wiki/Document_Object_Model
|
||||
[3]: https://openweathermap.org/api
|
||||
[4]: http://api.openweathermap.org/data/2.5/weather?lat=${this.latitude}\&lon=${this.longitude}\&appid=API\_KEY\`
|
||||
[5]: https://gist.github.com/rkpattnaik780/acc683d3796102c26c1abb03369e31f8
|
||||
[6]: https://opensource.com/sites/default/files/uploads/webcomponent.png (Web component displayed in a browser)
|
||||
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[8]: https://create-react-app.dev/docs/getting-started/
|
182
published/20220129 Reasons for servers to support IPv6.md
Normal file
182
published/20220129 Reasons for servers to support IPv6.md
Normal file
@ -0,0 +1,182 @@
|
||||
[#]: subject: "Reasons for servers to support IPv6"
|
||||
[#]: via: "https://jvns.ca/blog/2022/01/29/reasons-for-servers-to-support-ipv6/"
|
||||
[#]: author: "Julia Evans https://jvns.ca/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15142-1.html"
|
||||
|
||||
服务器支持 IPv6 的原因
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/15/155046v94vbmo5imykfkxz.jpg)
|
||||
|
||||
我一直在努力学习关于 IPv6 的相关知识。一方面,IPv6 的基础概念是很简单的(没有足够的 IPv4 地址可以满足互联网上的所有设备,所以人们发明了 IPv6!每个人都能有足够的 IPv6 地址!)
|
||||
|
||||
但是当我试图进一步理解它时,我遇到了很多问题。其中一个问题是:为什么 twitter.com 不支持 IPv6。假设,网站不支持 IPv6 并不会造成很多困难,那么为什么网站需要支持 IPv6 呢?
|
||||
|
||||
我在 Twitter 上询问了很多人 [为什么他们的服务器支持 IPv6][1],我得到了很多很好的答案,我将在这里总结一下。事先说明一下,因为我对 IPv6 基本上毫无经验,所以下面所总结的理由中可能会有写得不准确的地方,请大家多多包涵。
|
||||
|
||||
首先,我想解释一下为什么 twitter.com 可以不支持 IPv6,因为这是最先让我困惑的地方。
|
||||
|
||||
### 怎么知道 twitter.com 不支持 IPv6 呢?
|
||||
|
||||
你可以使用 `dig` 命令以 `AAAA` 的选项查询某一个域名的 IPv6 地址记录,如果没有记录,则表明该域名不支持 IPv6。除了 twitter.com,还有一些大型网站,如 github.com 和 stripe.com 也不支持 IPv6。
|
||||
|
||||
```
|
||||
$ dig AAAA twitter.com
|
||||
(empty response)
|
||||
$ dig AAAA github.com
|
||||
(empty response)
|
||||
$ dig AAAA stripe.com
|
||||
(empty response)
|
||||
```
|
||||
|
||||
### 为什么 twitter.com 仍然适用于 IPv6 用户?
|
||||
|
||||
我发现这真的很令人困惑。我一直听说因为 IPv4 地址已经用完了,从而很多互联网用户被迫要使用 IPv6 地址。但如果这是真的,twitter.com 怎么能继续为那些没有 IPv6 支持的人提供服务呢?以下内容是我昨天从 Twitter 会话中学习到的。
|
||||
|
||||
互联网服务提供商(ISP)有两种:
|
||||
|
||||
1. 能为所有用户拥有足够 IPv4 地址的 ISP
|
||||
2. 不能为所有用户拥有足够 IPv4 地址的 ISP
|
||||
|
||||
我的互联网服务提供商属于第 1 类,因此我的计算机有自己的 IPv4 地址,实际上我的互联网服务提供商甚至根本不支持 IPv6。
|
||||
|
||||
但是很多互联网服务提供商(尤其是北美以外的)都属于第 2 类:他们没有足够的 IPv4 地址供所有用户使用。这些互联网服务提供商通过以下方式处理问题:
|
||||
|
||||
* 为所有用户提供唯一的 IPv6 地址,以便他们可以直接访问 IPv6 网站
|
||||
* 让用户 _共享_ IPv4 地址,这可以使用 CGNAT(“<ruby>[运营商级 NAT][2]<rt>carrier-grade NAT</rt></ruby>”)或者“464XLAT”或其他方式。
|
||||
|
||||
所有互联网服务提供商都需要 _一些_ IPv4 地址,否则他们的用户将无法访问 twitter.com 等只能使用 IPv4 的网站。
|
||||
|
||||
### 为什么网站要支持 IPv6?
|
||||
|
||||
现在,我们已经解释了为什么可以 _不支持_ IPv6。那为什么要支持 IPv6 呢?有下面这些原因。
|
||||
|
||||
#### 原因一:CGNAT 是一个性能瓶颈
|
||||
|
||||
对我而言,支持 IPv6 最有说服力的论点是:CGNAT 是一个瓶颈,它会导致性能问题,并且随着对 IPv4 地址的访问变得越来越受限,它的性能会变得更糟。
|
||||
|
||||
有人也提到:因为 CGNAT 是一个性能瓶颈,因此它成为了一个有吸引力的拒绝服务攻击(DDoS)的目标,因为你可以通过攻击一台服务器,影响其他用户对该服务器的网站的可用性。
|
||||
|
||||
支持 IPv6 的服务器减少了对 CGNAT 的需求(IPv6 用户可以直接连接!),这使得互联网对每个人的响应速度都更快了。
|
||||
|
||||
我认为这个论点很有趣,因为它需要各方的努力——仅仅你的网站支持 IPv6,并不会让你的网站更好地运行,而更重要的是如果 _几乎每个网站_ 都支持 IPv6,那么它将使每个人的互联网体验更好,尤其对于那些无法轻松访问 IPv4 地址的国家/地区。
|
||||
|
||||
实际上,我不知道这在实践中会有多大的关系。
|
||||
|
||||
不过,使用 IPv6 还有很多更自私的论点,所以让我们继续探讨吧。
|
||||
|
||||
#### 原因二:只能使用 IPv6 的服务器也能够访问你的网站
|
||||
|
||||
我之前说过,大多数 IPv6 用户仍然可以通过 NAT 方式访问 IPv4 的网站。但是有些 IPv6 用户是不能访问 IPv4 网站的,因为他们发现他们运行的服务器只有 IPv6 地址,并且不能使用 NAT。因此,这些服务器完全无法访问只能使用 IPv4 的网站。
|
||||
|
||||
我想这些服务器并没有连接很多主机,也许它们只需要连接到一些支持 IPv6 的主机。
|
||||
|
||||
但对我来说,即使没有 IPv4 地址,一台主机也应该能够访问我的站点。
|
||||
|
||||
#### 原因三:更好的性能
|
||||
|
||||
对于同时使用 IPv4 和 IPv6(即具有专用 IPv6 地址和共享 IPv4 地址)的用户,IPv6 通常更快,因为它不需要经过额外的 NAT 地址转换。
|
||||
|
||||
因此,有时支持 IPv6 的网站可以为用户提供更快的响应。
|
||||
|
||||
在实际应用中,客户端使用一种称为“Happy Eyeballs”的算法,该算法能够从 IPv4 和 IPv6 中为用户选择一个最快的链接。
|
||||
|
||||
以下是网站支持 IPv6 的一些其他性能优势:
|
||||
|
||||
* 使用 IPv6 可以提高搜索引擎优化(SEO),因为 IPv6 具有更好的性能。
|
||||
* 使用 IPv6 可能会使你的数据包通过更好(更快)的网络硬件,因为相较于 IPv4,IPv6 是一个更新的协议。
|
||||
|
||||
#### 原因四:能够恢复 IPv4 互联网中断
|
||||
|
||||
有人说他碰到过由于意外的 BGP 中毒,而导致仅影响 IPv4 流量的互联网中断问题。
|
||||
|
||||
因此,支持 IPv6 的网站意味着在中断期间,网站仍然可以保持部分在线。
|
||||
|
||||
#### 原因五:避免家庭服务器的 NAT 问题
|
||||
|
||||
将 IPv6 与家庭服务器一起使用,会变得简单很多,因为数据包不必通过路由器进行端口转发,因此只需为每台服务器分配一个唯一的 IPv6 地址,然后直接访问服务器的 IPv6 地址即可。
|
||||
|
||||
当然,要实现这一点,客户端需要支持 IPv6,但如今越来越多的客户端也能支持 IPv6 了。
|
||||
|
||||
#### 原因六:为了拥有自己的 IP 地址
|
||||
|
||||
你也可以自己购买 IPv6 地址,并将它们用于家庭网络的服务器上。如果你更换了互联网服务提供商,可以继续使用相同的 IP 地址。
|
||||
|
||||
我不太明白这是如何工作的,是如何让互联网上的计算机将这些 IP 地址路由转发给你的?我猜测你需要运行自己的自治系统(AS)或其他东西。
|
||||
|
||||
#### 原因七:为了学习 IPv6
|
||||
|
||||
有人说他们在安全领域中工作,为保证信息安全,了解互联网协议的工作原理非常重要(攻击者正在使用互联网协议进行攻击!)。因此,运行 IPv6 服务器有助于他们了解其工作原理。
|
||||
|
||||
#### 原因八:为了推进 IPv6
|
||||
|
||||
有人说因为 IPv6 是当前的标准,因此他们希望通过支持 IPv6 来为 IPv6 的成功做出贡献。
|
||||
|
||||
很多人还说他们的服务器支持 IPv6,是因为他们认为只能使用 IPv4 的网站已经太“落后”了。
|
||||
|
||||
#### 原因九:IPv6 很简单
|
||||
|
||||
我还得到了一堆“使用 IPv6 很容易,为什么不用呢”的答案。在所有情况下添加 IPv6 支持并不容易,但在某些情况下添加 IPv6 支持会是很容易的,有以下的几个原因:
|
||||
|
||||
* 你可以从托管公司自动地获得 IPv6 地址,因此你只需要做的就是添加指向该地址的 `AAAA` 记录
|
||||
* 你的网站是基于支持 IPv6 的内容分发网络(CDN),因此你无需做任何额外的事情
|
||||
|
||||
#### 原因十:为了实施更安全的网络实验
|
||||
|
||||
因为 IPv6 的地址空间很大,所以如果你想在网络中尝试某些东西的时候,你可以使用 IPv6 子网进行实验,基本上你之后不会再用到这个子网了。
|
||||
|
||||
#### 原因十一:为了运行自己的自治系统(AS)
|
||||
|
||||
也有人说他们为了运行自己的自治系统(我在这篇 [BGP 帖子][3] 中谈到了什么是 AS),因此在服务器中提供 IPv6。IPv4 地址太贵了,所以他们为运行自治系统而购买了 IPv6 地址。
|
||||
|
||||
#### 原因十二:IPv6 更加安全
|
||||
|
||||
如果你的服务器 _只_ 有公共的 IPv6 地址,那么攻击者扫描整个网络,也不能轻易地找出你的服务器地址,这是因为 IPv6 地址空间太大了以至于不能扫描出来!
|
||||
|
||||
这显然不能是你仅有的安全策略,但是这是安全上的一个大大的福利。每次我运行 IPv4 服务器时,我都会惊讶于 IPv4 地址一直能够被扫描出来的脆弱性,就像是老版本的 WordPress 博客系统那样。
|
||||
|
||||
#### 一个很傻的理由:你可以在你的 IPv6 地址中放个小彩蛋
|
||||
|
||||
IPv6 地址中有很多额外的位,你可以用它们做一些不重要的事情。例如,Facebook 的 IPv6 地址之一是“2a03:2880:f10e:83:face:b00c:0:25de”(其中包含 `face:b00c`)。
|
||||
|
||||
### 理由还有很多
|
||||
|
||||
这就是到目前为止我所了解的“为什么支持 IPv6?”的理由。
|
||||
|
||||
在我理解这些原因后,相较于以前,我在我的(非常小的)服务器上支持 IPv6 更有动力了。但那是因为我觉得支持 IPv6,对我来说只需要很少的努力。(现在我使用的是支持 IPv6 的 CDN,所以我基本上不用做什么额外的事情)
|
||||
|
||||
我仍然对 IPv6 知之甚少,但是在我的印象中,支持 IPv6 并不是不需要花费精力的,实际上可能需要大量工作。例如,我不知道 Twitter 在其边缘服务器上添加 IPv6 支持需要做多少繁杂的工作。
|
||||
|
||||
### 其它关于 IPv6 的问题
|
||||
|
||||
这里还有一些关于 IPv6 的问题,也许我之后再会探讨:
|
||||
|
||||
* 支持 IPv6 的缺点是什么?什么会出错呢?
|
||||
* 对于拥有了足够 IPv4 地址的 ISP 来说,有什么让他们提供 IPv6 的激励措施?(另一种问法是:我的 ISP 是否有可能在未来几年内转为支持 IPv6?或者他们可能不会支持 IPv6?)
|
||||
* [Digital Ocean][4] (LCTT 译注:一家建立于美国的云基础架构提供商,面向软件开发人员提供虚拟专用服务器(VPS))只提供 IPv4 的浮动地址,不提供 IPv6 的浮动地址。为什么不提供呢?有更多 IPv6 地址,那提供 IPv6 的浮动地址不是变得更 _便捷_ 吗?
|
||||
* 当我尝试 ping IPv6 地址时(例如 example.com 的 IP 地址`2606:2800:220:1:248:1893:25c8:1946`),我得到一个报错信息 `ping: connect: Network is unreachable`。这是为什么呢?(回答:因为我的 ISP 不支持 IPv6,所以我的电脑没有公共 IPv6 地址)
|
||||
|
||||
这篇 [来自 Tailscale 的 IPv4 与 IPv6 文章][5] 非常有意思,并回答了上述的一些问题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2022/01/29/reasons-for-servers-to-support-ipv6/
|
||||
|
||||
作者:[Julia Evans][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://twitter.com/b0rk/status/1487156306884636672
|
||||
[2]: https://en.wikipedia.org/wiki/Carrier-grade_NAT
|
||||
[3]: https://jvns.ca/blog/2021/10/05/tools-to-look-at-bgp-routes/
|
||||
[4]: https://docs.digitalocean.com/products/networking/floating-ips/
|
||||
[5]: https://tailscale.com/kb/1134/ipv6-faq/
|
@ -0,0 +1,260 @@
|
||||
[#]: subject: "Advantages and Disadvantages of Using Linux"
|
||||
[#]: via: "https://itsfoss.com/advantages-linux/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15136-1.html"
|
||||
|
||||
使用 Linux 的优势和劣势
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/13/000526wn58kyntpp0ynt0z.jpg)
|
||||
|
||||
Linux 是一个流行词,你到处都能听到与 Linux 相关的内容。人们在技术论坛上讨论它、Linux 是课程中的一部分;你最喜欢的 YouTube 技术主播在兴奋地展示构建他们的 Linux 内核;你在 Twitter 上关注的 <ruby>10 倍效率开发者<rt>10x developers</rt></ruby>都是 Linux 粉丝。
|
||||
|
||||
基本上,Linux 无处不在,每个人都在谈论它,因此你可能会不自主地陷入到对错失了 “学习 Linux” 的不安中。
|
||||
|
||||
所以,你想知道 Linux 的优势是什么,以及它是否值得去学习。
|
||||
|
||||
在这篇文章中,我总结了很多 Linux 的优势和劣势。
|
||||
|
||||
如果你在选择 Linux 还是你喜欢的操作系统上犹豫不决,我们愿意为你提供一些帮助。
|
||||
|
||||
> 在开始之前,我们要指出的是,“Linux” 本身并不是一个操作系统,它的操作系统被称为 [Linux 发行版][1],而且 Linux 的发行版有数百种。为简单起见,我将其称为 Linux 操作系统,而不是某个特定的 Linux 发行版。可以参考 [这篇文章][2],来更好地理解这些东西。
|
||||
|
||||
### 使用 Linux 的优势
|
||||
|
||||
如果你想使用 Linux 替代现在的操作系统,那么只有当你了解 Linux 的优势,才会有意义。
|
||||
|
||||
如果 Linux 在你想要它做的事情上表现出色,你将永远都不会后悔你的决定。
|
||||
|
||||
#### 不用购买许可证
|
||||
|
||||
![open source proprietary illustration][3]
|
||||
|
||||
你需要拥有苹果公司的设备,才能使用 macOS 作为日常使用;你需要拥有 Windows 许可证,才能使用微软的 Windows。
|
||||
|
||||
因此,你需要对这些东西进行一定的投资。但是,对于 Linux 呢?它是完全免费的!
|
||||
|
||||
与 Windows 和 macOS 相比,不仅仅是操作系统上的不同,Linux 上还有许多免费的软件包。
|
||||
|
||||
你无需支付许可证费用,就可以使用所有主流的 Linux 发行版。当然,你可以选择捐赠来支持该项目,但这完全取决于你自己的意愿。
|
||||
|
||||
**此外**,Linux 是完全开源的,这意味着所有人都能检查源代码的透明度。
|
||||
|
||||
#### 能以最小的系统资源运行
|
||||
|
||||
![linux mint 21 resource usage][4]
|
||||
|
||||
通常,用户考虑尝试另一个操作系统,是因为他们对现有系统的性能感到沮丧。
|
||||
|
||||
这也是我的个人经历。我受朋友的委托,使用 Linux 来更新他们的旧笔记本电脑或经常滞后的系统。
|
||||
|
||||
而且,Linux 发行版能够在普通的硬件配置上运行,你不需要拥有最新最好的硬件。此外,还有专门的 [轻量级 Linux 发行版][5] 可以在较旧的硬件上运行而不会出现问题。
|
||||
|
||||
因此,如果你立即使用 Linux,你有更多的机会恢复你的旧系统,或在短时间内获得一个快速的计算机。
|
||||
|
||||
#### 更少地受到恶意软件的威胁
|
||||
|
||||
![malware illustration][6]
|
||||
|
||||
没有操作系统可以免受恶意文件或脚本的侵害。如果你从未知来源下载并运行某些内容,则无法保证其安全性。
|
||||
|
||||
然而,对于 Linux,情况会更好一些。诚然,研究人员已经发现了针对 Linux 物联网设备的攻击者。但是,对于桌面 Linux,还无须担心。
|
||||
|
||||
恶意攻击者攻击的目标是更受家庭欢迎的平台,而 Linux 在桌面领域并没有很大的市场份额来吸引到这种关注。在某种程度上,这可能是一件好事。
|
||||
|
||||
你要做的就是坚持使用官方软件包,并在执行任何操作之前阅读指导说明。
|
||||
|
||||
另外,在 Linux 上,你也不用安装防病毒程序,来保护本机免受恶意软件的威胁。
|
||||
|
||||
#### 可个性化定制
|
||||
|
||||
![Pop!_OS 22.04 LTS][7]
|
||||
|
||||
有了开源的代码,你就可以根据需要自由定制你的 Linux 体验。
|
||||
|
||||
当然,你需要具备一些专业知识,才能充分地定制你的 Linux。但是与 macOS 和 Windows 相比,即使你没有任何经验,也可以在 Linux 操作系统中获得更多自定义功能。
|
||||
|
||||
![Customized Linux experience | Reddit user: u/ZB652][8]
|
||||
|
||||
如果你想要个性化你的体验,并愿意付出额外的努力,那么 Linux 就非常适合你。例如,你可以参考 [KDE 定制指南][10] 和 [停靠区选项][11] 以获得基本的自定义方法。
|
||||
|
||||
#### 适用于所有人
|
||||
|
||||
使用 macOS 或 Windows,你只能在微软或苹果最终确定的设计/偏好选择中,做出你的选择。
|
||||
|
||||
但是,对于 Linux,你能发现专注于各种事情的不同的 Linux 发行版。
|
||||
|
||||
例如,你可以选择能始终获取最新功能的 Linux 发行版,或者你也可以选择只为你提供安全/维护更新的 Linux 发行版。
|
||||
|
||||
你可以使用有开箱即用、外观好看的 Linux 发行版,或提供最大程度的自定义选项的 Linux 发行版。Linux 发行版的选择是多种多样的。
|
||||
|
||||
我建议你从 [能提供最佳用户体验的选项][12] 开始。
|
||||
|
||||
#### 完整的开发环境
|
||||
|
||||
如果你是软件开发人员或学习编程的学生,Linux 绝对是有优势的。许多构建工具都能在 Linux 上使用,并能够集成到 Linux 中。使用容器(Docker),你可以轻松创建专门的测试环境。
|
||||
|
||||
微软知道这个价值,因此它创建了 WSL,让开发人员可以在 Windows 内访问 Linux 环境。尽管如此,WSL 并没有接近真正的 Linux 体验,在 Windows 上使用 Docker 也同样如此。
|
||||
|
||||
但是这并不适用于网页设计,因为极为好用的 Adobe 工具并不能在 Linux 上使用。但是,如果你的工作不需要 Adobe,Linux 会是一个不错的选择。
|
||||
|
||||
#### Linux 是一项必须学习的技能!
|
||||
|
||||
使用 Linux 有一个学习曲线,刚开始时掌握的速度最快,之后则逐渐变得平缓,但是它给你提供了对各种事物的洞察力。
|
||||
|
||||
你可以通过探索和自由定制 Linux,或者仅仅是通过使用它,来了解操作系统中的事物是如何工作的。
|
||||
|
||||
不是每个人都知道如何使用 Linux。
|
||||
|
||||
因此,通过学习 Linux 来获得和扩展你对软件和计算机的知识会是一项很棒的技能。
|
||||
|
||||
#### Linux 是一个必要的工作技能
|
||||
|
||||
![job illustration][13]
|
||||
|
||||
正如我之前提及的,学习 Linux 是一个很好的技能,这不仅仅能增长你的知识,它在职业方面也很有用。
|
||||
|
||||
通过学习 Linux 的基础知识,你可以成为 Linux 系统管理员或安全专家,并且能胜任很多其他的工作。
|
||||
|
||||
因此,学习 Linux 开辟了一系列机会!
|
||||
|
||||
#### 保护隐私
|
||||
|
||||
如果你没有微软账号,那么你就不能使用 Windows。当你启动 Windows 时,你会发现它会在很多的服务和应用中记录你的数据。
|
||||
|
||||
![privacy windows][14]
|
||||
|
||||
虽然你可以找到此类设置并禁用它们,但很明显,Windows 的默认配置不会考虑你的隐私。
|
||||
|
||||
而在 Linux 中,并非如此。虽然某些应用程序/发行版会有一个可选功能,让你可以与他们分享有用的东西,但这并不是什么大问题。Linux 上的大多数东西都是经过定制的,默认情况下可以为你提供最大的隐私,从而无需配置任何东西。
|
||||
|
||||
但是,苹果和微软会采用巧妙的策略从你的计算机收集匿名的使用数据。偶尔,他们会记录你在他们的应用商店的活动,以及当你通过你的账户登录时的信息。
|
||||
|
||||
#### 自定义项目和自托管
|
||||
|
||||
你是一个喜欢捣鼓小发明的人吗?如果你喜欢制作电子或软件项目,Linux 会是你的发明天堂。
|
||||
|
||||
你可以在 [诸如树莓派这样的单板机][15] 上使用 Linux,开发出一些很酷的东西,例如复古游戏机、家庭自动化系统等等。
|
||||
|
||||
你也能在你自己的服务器上部署开源的软件,并维护他们。这称为自托管,它有以下的优点:
|
||||
|
||||
* 减少托管费用
|
||||
* 掌控你的数据
|
||||
* 对于你的每个需求,定制应用/服务
|
||||
|
||||
你能直接使用 Linux 或者使用基于 Linux 的工具,来做这所有的事情。
|
||||
|
||||
### 使用 Linux 的劣势
|
||||
|
||||
Linux 并不是一个没有缺点的选择。任何事都具有两面性,Linux 也有一些不好的地方,包括:
|
||||
|
||||
#### 不容易快速上手
|
||||
|
||||
![too much learn illustration][16]
|
||||
|
||||
学习的目的通常不在于掌握一项新技能,更重要的是尽可能快地适应。
|
||||
|
||||
如果用户使用某一个东西,却无法完成任务,那么它并不适合他们。对于每个操作系统也是如此。例如,使用 Windows/macOS 的用户可能不会很快适应 Linux。
|
||||
|
||||
你可以阅读我们的比较文章以了解 [macOS 和 Linux 之间的区别][17]。
|
||||
|
||||
我同意一些人会比其他人学习速度更快。但是,总体而言,当你踏入 Linux 世界时,你需要付出一点努力,去学习那些不明显的东西。
|
||||
|
||||
#### 多样性
|
||||
|
||||
虽然我们建议使用 [为初学者量身定制的最佳 Linux 发行版][18],但一开始就选择你喜欢的版本,可能会让人不知所措。
|
||||
|
||||
你可能会想尝试其中多个版本,以查看最适合你的 Linux 发行版,但是这既耗时又令人十分困惑。
|
||||
|
||||
最好选择其中一种 Linux 发行版。但是,如果你仍然感到困惑,你可以仍旧使用 Windows/macOS。
|
||||
|
||||
#### 在桌面领域的市场份额相对较低
|
||||
|
||||
![linux desktop market share][19]
|
||||
|
||||
Linux 不是流行的桌面操作系统。
|
||||
|
||||
这不应该是用户关心的问题。但是,如果没有大的市场占有率,就不能指望应用程序开发人员为 Linux 开发/维护工具。
|
||||
|
||||
当然,现在 Linux 有很多重要且流行的工具,比以往任何时候都多。但是,这仍然是一个因素,意味着并非所有好的工具/服务都可以在 Linux 上运行。
|
||||
|
||||
请参阅我们定期更新的关于 [Linux 的市场份额][20] 的文章,了解相关内容。
|
||||
|
||||
#### 缺少专有软件
|
||||
|
||||
正如我上面提到的,并不是开发者都对将他们的工具/应用程序引入 Linux 感兴趣。
|
||||
|
||||
因此,你可能在 Linux 上找不到适用于 Windows/macOS 的所有优质专有产品。诚然,你可以使用兼容层在 Linux 上运行 Windows/macOS 程序。
|
||||
|
||||
但这并不总是有效。例如,你没有支持 Linux 的官方微软 365 和像 Wallpaper Engine 这样的工具。
|
||||
|
||||
#### 不是游戏优先的操作系统
|
||||
|
||||
![gaming illustration][21]
|
||||
|
||||
如果你想在电脑上玩游戏,Windows 仍然是支持最新硬件和技术的最佳选择。
|
||||
|
||||
谈到 Linux,有很多 “如果和但是” 需要一个明确的答案。
|
||||
|
||||
请注意,你可以在 Linux 上玩很多现代游戏,但在各种不同的硬件上可能不会有一致的体验。正如我们的一位读者在评论中建议的那样,你可以使用 Steam Play 在 Linux 上尝试许多 Windows 独占的游戏,而不会出现潜在的障碍。
|
||||
|
||||
Steam Deck 正在鼓励更多的游戏开发者使他们的游戏在 Linux 上运行得更好。而且,这在不久的将来只会得到改善。因此,如果你能花点功夫在 Linux 上尝试你最喜欢的游戏,可能不会让人失望。
|
||||
|
||||
话虽如此,在 Linux 上玩游戏并不方便。如果你有兴趣,可以参考我们的 [Linux 游戏指南][22] 以了解更多信息。
|
||||
|
||||
#### 缺少专业的技术支持
|
||||
|
||||
我知道不是每个人都需要技术支持。但是,一些技术支持选项能够在他们的笔记本电脑或计算机上远程指导用户/修复问题。
|
||||
|
||||
使用 Linux,你可以向社区寻求帮助,但它可能不像某些专业技术支持服务那样好用。
|
||||
|
||||
你仍然需要自己完成大部分努力,并自己尝试一些东西,并不是每个人都喜欢这样做的。
|
||||
|
||||
### 总结
|
||||
|
||||
我主要是 Linux 用户,但我在玩游戏时使用 Windows。虽然我偏好 Linux,但我尽力在这篇文章中对 Linux 保持中立态度,并给你足够的指导,以便你可以决定 Linux 是否适合你。
|
||||
|
||||
如果你打算使用 Linux,并且从未使用过它,请迈出你的第一步吧,可以参考 [在虚拟机中使用 Linux 的第一步][23]。如果你有 Windows 11,你也可以使用 WSL2。
|
||||
|
||||
我非常乐意收到你的评价和建议。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/advantages-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/what-is-linux/
|
||||
[2]: https://itsfoss.com/what-is-linux/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/08/open-source-proprietary-illustration.jpg
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/08/linux-mint-21-resource-usage.jpg
|
||||
[5]: https://itsfoss.com/lightweight-linux-beginners/
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/09/malware-illustration.jpg
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/08/pop-os-screenshot-2022.png
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/09/customization-reddit-unixporn.jpg
|
||||
[9]: https://www.reddit.com/r/unixporn/comments/wzu5nl/plasma_cscx2n/
|
||||
[10]: https://itsfoss.com/kde-customization/
|
||||
[11]: https://itsfoss.com/best-linux-docks/
|
||||
[12]: https://itsfoss.com/beautiful-linux-distributions/
|
||||
[13]: https://itsfoss.com/wp-content/uploads/2022/09/job-illustration.jpg
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/09/privacy-windows.webp
|
||||
[15]: https://itsfoss.com/raspberry-pi-alternatives/
|
||||
[16]: https://itsfoss.com/wp-content/uploads/2022/09/too-much-learn-illustration.jpg
|
||||
[17]: https://itsfoss.com/mac-linux-difference/
|
||||
[18]: https://itsfoss.com/best-linux-beginners/
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2017/09/linux-desktop-market-share.jpg
|
||||
[20]: https://itsfoss.com/linux-market-share/
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/08/gaming-illustration.jpg
|
||||
[22]: https://itsfoss.com/linux-gaming-guide/
|
||||
[23]: https://itsfoss.com/why-linux-virtual-machine/
|
186
published/20220919 PyLint- The good, the bad, and the ugly.md
Normal file
186
published/20220919 PyLint- The good, the bad, and the ugly.md
Normal file
@ -0,0 +1,186 @@
|
||||
[#]: subject: "PyLint: The good, the bad, and the ugly"
|
||||
[#]: via: "https://opensource.com/article/22/9/pylint-good-bad-ugly"
|
||||
[#]: author: "Moshe Zadka https://opensource.com/users/moshez"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15144-1.html"
|
||||
|
||||
PyLint 的优点、缺点和危险
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/16/093840z9pnzfv9ykfccoq9.jpg)
|
||||
|
||||
> 充分利用 PyLint。
|
||||
|
||||
敲黑板:PyLint 实际上很好!
|
||||
|
||||
“PyLint 可以拯救你的生命”,这是一句夸张的描述,但没有你想象的那么夸张。PyLint 可以让你远离非常难找到的和复杂的缺陷。最差的情况下,它只可以节省测试运行的时间。最好的情况下,它可以帮你避免生产环境中复杂的错误。
|
||||
|
||||
### 优点
|
||||
|
||||
我不好意思说这种情况是多么普遍。测试的命名总是*那么奇怪*:没有人关心这个名称,而且通常也找不到一个自然的名称。例如以下代码:
|
||||
|
||||
```
|
||||
def test_add_small():
|
||||
# Math, am I right?
|
||||
assert 1 + 1 == 3
|
||||
|
||||
def test_add_large():
|
||||
assert 5 + 6 == 11
|
||||
|
||||
def test_add_small():
|
||||
assert 1 + 10 == 11
|
||||
```
|
||||
|
||||
测试生效:
|
||||
|
||||
```
|
||||
collected 2 items
|
||||
test.py ..
|
||||
2 passed
|
||||
```
|
||||
|
||||
但问题是:如果你覆盖了一个测试的名称,测试框架将愉快地跳过这个测试!
|
||||
|
||||
实际上,这些文件可能有数百行,而添加新测试的人可能并不知道所有的名称。除非有人仔细查看测试输出,否则一切看起来都很好。
|
||||
|
||||
最糟糕的是,*被覆盖测试的添加*、*被覆盖测试造成的破坏*,以及*连锁反应的问题*可能要几天、几月甚至几年才能发现。
|
||||
|
||||
### PyLint 会找到它
|
||||
|
||||
就像一个好朋友一样,PyLint 可以帮助你。
|
||||
|
||||
```
|
||||
test.py:8:0: E0102: function already defined line 1
|
||||
(function-redefined)
|
||||
```
|
||||
|
||||
### 缺点
|
||||
|
||||
就像 90 年代的情景喜剧一样,你对 PyLint 了解的越多,问题就越多。以下是一个库存建模程序的常规代码:
|
||||
|
||||
```
|
||||
"""Inventory abstractions"""
|
||||
|
||||
import attrs
|
||||
|
||||
@attrs.define
|
||||
class Laptop:
|
||||
"""A laptop"""
|
||||
ident: str
|
||||
cpu: str
|
||||
```
|
||||
|
||||
但 PyLint 似乎有自己的观点(可能形成于 90 年代),并且不怕把它们作为事实陈述出来:
|
||||
|
||||
```
|
||||
$ pylint laptop.py | sed -n '/^laptop/s/[^ ]*: //p'
|
||||
R0903: Too few public methods (0/2) (too-few-public-methods)
|
||||
```
|
||||
|
||||
### 危险
|
||||
|
||||
有没有想过在一个数百万人使用的工具中加入自己未证实的观点?PyLint 每月有 1200 万次下载。
|
||||
|
||||
> “如果太挑剔,人们会取消检查” — 这是 PyLint GitHub 的 6987 号议题,于 2022 年 7 月 3 号提出
|
||||
|
||||
对于添加一个可能有许多误报的测试,它的态度是 ... “*嗯*”。
|
||||
|
||||
### 让它为你工作
|
||||
|
||||
PyLint 很好,但你需要小心地与它配合。为了让 PyLint 为你工作,以下是我推荐的三件事:
|
||||
|
||||
#### 1、固定版本
|
||||
|
||||
固定你使用的 PyLint 版本,避免任何惊喜!
|
||||
|
||||
在你的 `.toml` 文件中定义:
|
||||
|
||||
```
|
||||
[project.optional-dependencies]
|
||||
pylint = ["pylint"]
|
||||
```
|
||||
|
||||
在代码中定义:
|
||||
|
||||
```
|
||||
from unittest import mock
|
||||
```
|
||||
|
||||
这与以下代码对应:
|
||||
|
||||
```
|
||||
# noxfile.py
|
||||
...
|
||||
@nox.session(python=VERSIONS[-1])
|
||||
def refresh_deps(session):
|
||||
"""Refresh the requirements-*.txt files"""
|
||||
session.install("pip-tools")
|
||||
for deps in [..., "pylint"]:
|
||||
session.run(
|
||||
"pip-compile",
|
||||
"--extra",
|
||||
deps,
|
||||
"pyproject.toml",
|
||||
"--output-file",
|
||||
f"requirements-{deps}.txt",
|
||||
)
|
||||
```
|
||||
|
||||
#### 2、默认禁止
|
||||
|
||||
禁用所有检查,然后启用那些你认为误报比率高的。(不仅仅是漏报/误报的比率!)
|
||||
|
||||
```
|
||||
# noxfile.py
|
||||
...
|
||||
@nox.session(python="3.10")
|
||||
def lint(session):
|
||||
files = ["src/", "noxfile.py"]
|
||||
session.install("-r", "requirements-pylint.txt")
|
||||
session.install("-e", ".")
|
||||
session.run(
|
||||
"pylint",
|
||||
"--disable=all",
|
||||
*(f"--enable={checker}" for checker in checkers)
|
||||
"src",
|
||||
)
|
||||
```
|
||||
|
||||
#### 3、检查器
|
||||
|
||||
以下是我喜欢的检查器。加强项目的一致性,避免一些明显的错误。
|
||||
|
||||
```
|
||||
checkers = [
|
||||
"missing-class-docstring",
|
||||
"missing-function-docstring",
|
||||
"missing-module-docstring",
|
||||
"function-redefined",
|
||||
]
|
||||
```
|
||||
|
||||
### 使用 PyLint
|
||||
|
||||
你可以只使用 PyLint 好的部分。在 CI 中运行它以保持一致性,并使用常用检查器。
|
||||
|
||||
放弃不好的部分:默认禁止检查器。
|
||||
|
||||
避免危险的部分:固定版本以避免意外。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/pylint-good-bad-ugly
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/python_programming_question.png
|
@ -3,23 +3,24 @@
|
||||
[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Donkey-Hao"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15130-1.html"
|
||||
|
||||
我在 Linux 中使用的 5 个 Git 配置
|
||||
======
|
||||
这份简要指南能够帮助你快速开始使用 Git,以及配置一些选项。
|
||||
|
||||
![Linux keys on the keyboard for a desktop computer][1]
|
||||
> 这份简要指南能够帮助你快速开始使用 Git,以及配置一些选项。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/11/162338c314ls57bg51hd45.jpg)
|
||||
|
||||
在 Linux 中设置 Git 十分简单,但为了获得完美的配置,我做了以下五件事:
|
||||
|
||||
1. [创建全局配置][2]
|
||||
2. [设置默认名称][3]
|
||||
3. [设置默认邮箱地址][4]
|
||||
4. [设置默认分支名称][5]
|
||||
5. [设置默认编辑器][6]
|
||||
1. 创建全局配置
|
||||
2. 设置默认名称
|
||||
3. 设置默认邮箱地址
|
||||
4. 设置默认分支名称
|
||||
5. 设置默认编辑器
|
||||
|
||||
我使用 Git 管理我的代码、命令行脚本以及文档版本。这意味着每次我开始一项新的任务,首先我需要创建一个文件目录并将其添加到 Git 库中:
|
||||
|
||||
@ -38,9 +39,9 @@ $ git config user.email alan@opensource.com
|
||||
fatal: not in a git directory
|
||||
```
|
||||
|
||||
此外,当这个命令在 Git 仓库中运行时,它只会配置特定的一个。在新的仓库中,你不得不重复这个步骤。我可以通过全局配置来避免重复。选项 *--global* 会指示 Git 将邮箱地址写入全局配置 `~/.gitconfig` 文件中,甚至在必要时会创建它:
|
||||
此外,当这个命令在 Git 仓库中运行时,它只会配置特定的一个仓库。在新的仓库中,你不得不重复这个步骤。我可以通过全局配置来避免重复。选项 `--global` 会指示 Git 将邮箱地址写入全局配置 `~/.gitconfig` 文件中,甚至在必要时会创建它:
|
||||
|
||||
> 请记住,波浪线(~) 代表你的 `home` 文件夹。在我的电脑中它是 `/home/alan`。
|
||||
> 请记住,波浪线(`~`)代表你的主文件夹。在我的电脑中它是 `/home/alan`。
|
||||
|
||||
```
|
||||
$ git config --global user.email alan@opensource.com
|
||||
@ -51,7 +52,7 @@ $ cat ~/.gitconfig
|
||||
|
||||
这里的缺点是,如果你有大量偏好设置,需要输入很多命令,这将花费大量时间并且很容易出错。Git 提供了更加快捷有效的方式,可以直接编辑你的全局配置文件——这是我列表中的第一项!
|
||||
|
||||
### 1. 创建全局配置
|
||||
### 1、创建全局配置
|
||||
|
||||
如果你刚开始使用 Git,或许你还没有该文件。不用担心,让我们直接开始。只需要用 `--edit` 选项:
|
||||
|
||||
@ -75,15 +76,15 @@ $ git config --global --edit
|
||||
|
||||
现在我们已经打开了编辑器,并且 Git 已经在后台创建了全局配置文件,我们可以继续接下来的设置。
|
||||
|
||||
### 2. 设置默认名称
|
||||
### 2、设置默认名称
|
||||
|
||||
名称是该文件中的首要条目,让我们先从它开始。用命令行设置我的名称是 `git config --global user.name "Alan Formy-Duval"`。只需要在配置文件中编辑 *name* 条目就行,而不是在命令行中运行命令:
|
||||
名字是该文件中的首要条目,让我们先从它开始。用命令行设置我的名称是 `git config --global user.name "Alan Formy-Duval"`。不用在命令行中运行该命令,只需要在配置文件中编辑 `name` 条目就行:
|
||||
|
||||
```
|
||||
name = Alan Formy-Duval
|
||||
```
|
||||
|
||||
### 3. 设置默认邮箱地址
|
||||
### 3、设置默认邮箱地址
|
||||
|
||||
邮箱地址是第二个条目,让我们添加它。默认情况下,Git 使用你的系统提供的名称和邮箱地址。如果不正确或者你想要更改,你可以在配置文件中具体说明。事实上,如果你没有配置这些,Git 在你第一次提交时会友好的提示你:
|
||||
|
||||
@ -93,18 +94,17 @@ Your name and email address were configured automatically based
|
||||
on your username and hostname. Please check that they are accurate....
|
||||
```
|
||||
|
||||
在命令行中运行 `git config --global user.email`**["alan@opensource.com"][7]** 会设置好我的邮箱。同样,我们在配置文件中编辑 *email* 条目,提供你的邮箱地址:
|
||||
在命令行中运行 `git config --global user.email "alan@opensource.com"` 会设置好我的邮箱。同样,我们在配置文件中编辑 `email` 条目,提供你的邮箱地址:
|
||||
|
||||
```
|
||||
email = alan@opensource.com
|
||||
```
|
||||
|
||||
|
||||
我喜欢设置的最后两个设置是默认分支名称和默认编辑器。当你仍在编辑器中时,需要添加这些指令。
|
||||
|
||||
### 4. 设置默认分支名称
|
||||
### 4、设置默认分支名称
|
||||
|
||||
目前有一种趋势,即不再使用 *master* 作为默认分支名称。事实上,在新存储库初始化时,Git 将通过友好的消息提示更改默认分支名称:
|
||||
目前有一种趋势,即不再使用 `master` 作为默认分支名称。事实上,在新存储库初始化时,Git 将通过友好的消息提示更改默认分支名称:
|
||||
|
||||
```
|
||||
$ git init
|
||||
@ -115,23 +115,23 @@ hint:
|
||||
hint: git config --global init.defaultBranch <name>
|
||||
```
|
||||
|
||||
这个名为 *defaultBranch* 的指令需要位于一个名为 *init* 的新部分中。现在普遍接受的是,许多程序员使用 *main* 这个词作为他们的默认分支。这是我喜欢使用的。将此部分后跟指令添加到配置中:
|
||||
这个名为 `defaultBranch` 的指令需要位于一个名为 `init` 的新部分中。现在普遍接受的是,许多程序员使用 `main` 这个词作为他们的默认分支。这是我喜欢使用的。将此部分后跟指令添加到配置中:
|
||||
|
||||
```
|
||||
[init]
|
||||
defaultBranch = main
|
||||
```
|
||||
|
||||
### 5. 设置默认编辑器
|
||||
### 5、设置默认编辑器
|
||||
|
||||
第五个设置是,设置默认的编辑器。这是指 Git 将使用的编辑器,用于在你每次将更改提交到存储库时输入你的提交消息。不论是 [nano][8]、[emacs][9]、[vi][10] 还是其他编辑器,每个人都有他喜欢的。我喜欢用 vi。添加 *core* 部分,并设置 *editor* 指令为你喜欢的编辑器。
|
||||
第五个设置是设置默认的编辑器。这是指 Git 将使用的编辑器,用于在你每次将更改提交到存储库时输入你的提交消息。不论是 [nano][8]、[emacs][9]、[vi][10] 还是其他编辑器,每个人都有他喜欢的。我喜欢用 vi。添加 `core` 部分,并设置 `editor` 指令为你喜欢的编辑器。
|
||||
|
||||
```
|
||||
[core]
|
||||
editor = vi
|
||||
```
|
||||
|
||||
这是最后一项。退出编辑器。Git 在 *home* 目录下保存全局配置文件。如果你再次运行编辑命令,将会看到所有内容。要知道。配置文件是明文存储的文本文件,因此它可以很容易使用文本工具查看,如 [cat][11] 命令。这是我的配置文件内容:
|
||||
这是最后一项。退出编辑器。Git 在主目录下保存全局配置文件。如果你再次运行编辑命令,将会看到所有内容。注意配置文件是明文存储的文本文件,因此它可以很容易使用文本工具查看,如 [cat][11] 命令。这是我的配置文件内容:
|
||||
|
||||
```
|
||||
$ cat ~/.gitconfig
|
||||
@ -144,6 +144,8 @@ $ cat ~/.gitconfig
|
||||
defaultBranch = main
|
||||
```
|
||||
|
||||
这是一个简单的指南,可以让你快速开始使用 Git 和它的一些配置选项。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/git-configuration-linux
|
||||
@ -151,7 +153,7 @@ via: https://opensource.com/article/22/9/git-configuration-linux
|
||||
作者:[Alan Formy-Duval][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Donkey-Hao](https://github.com/Donkey-Hao)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,25 +3,28 @@
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15132-1.html"
|
||||
|
||||
使用 PostgreSQL 建立你的数据库
|
||||
======
|
||||
Postgres 是最灵活的数据库之一,并且它是开源的。
|
||||
|
||||
数据库是一种有组织性且灵活地存储信息的工具。电子表格在本质上就是一个数据库,但是图形化应用程序这一限制使得大多数的电子表格应用程序对程序员毫无用处。随着 [边缘计算][3] 和物联网设备成为重要的平台,开发者们需要更有效且轻量级的方法,来存储、处理、查询大量的数据。我最爱的一种结合是使用 [Lua 连接][4] PostgreSQL 数据库。无论你使用什么编程语言,Postgres 一定是数据库的绝佳选择,但是在使用 Postgres 之前,首先你需要知道一些基本的东西。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/12/100311t4k1k8hfmh4df5hh.jpg)
|
||||
|
||||
### 安装 Postgres
|
||||
> PostgreSQL 是最灵活的数据库之一,并且它是开源的。
|
||||
|
||||
在 linux 上安装 PostgreSQL,要使用你的软件库。在 Fedora,CentOS,Megeia 等类似的 linux 版本上使用命令:
|
||||
数据库是以一种有组织且灵活的方式存储信息的工具。电子表格在本质上就是一个数据库,但是图形化应用程序这一限制使得大多数的电子表格应用程序对程序员毫无用处。随着 [边缘计算][3] 和物联网设备成为重要的平台,开发者们需要更有效且轻量级的方法,来存储、处理、查询大量的数据。我最爱的一种组合是使用 [Lua 连接][4] PostgreSQL 数据库。无论你使用什么编程语言,PostgreSQL 一定是数据库的绝佳选择,但是在使用 PostgreSQL 之前,首先你需要知道一些基本的东西。
|
||||
|
||||
### 安装 PostgreSQL
|
||||
|
||||
在 Linux 上安装 PostgreSQL,要使用你的软件库。在 Fedora,CentOS,Megeia 等类似的 Linux 版本上使用命令:
|
||||
|
||||
```
|
||||
$ sudo dnf install postgresql postgresql-server
|
||||
```
|
||||
|
||||
在 Debian, Linux Mint, Elementary 等类似的 linux 版本上使用命令:
|
||||
在 Debian, Linux Mint, Elementary 等类似的 Linux 版本上使用命令:
|
||||
|
||||
```
|
||||
$ sudo apt install postgresql postgresql-contrib
|
||||
@ -29,14 +32,13 @@ $ sudo apt install postgresql postgresql-contrib
|
||||
|
||||
在 macOs 和 Windows 上,可以从官网 [postgresql.org][5] 下载安装包。
|
||||
|
||||
### 配置 Postgres
|
||||
### 配置 PostgreSQL
|
||||
|
||||
Most distributions install the Postgres database without *starting* it, but provide you with a script or [systemd service][6] to help it start reliably. However, before you start PostgreSQL, you must create a database cluster.
|
||||
大多数发行版安装 Postgres 数据库时没有启动它,但是为你提供了一个脚本或 [systemd 服务][6],能够可靠地启动 Postgres。但是,在启动 PostgreSQL 之前,必须创建一个数据库集群。
|
||||
大多数发行版安装 PostgreSQL 数据库时没有启动它,但是为你提供了一个脚本或 [systemd 服务][6],能够可靠地启动 PostgreSQL。但是,在启动 PostgreSQL 之前,必须创建一个数据库集群。
|
||||
|
||||
#### Fedora
|
||||
|
||||
在 Fedora,CentOS 等类似的版本上,Postgres 安装包中提供了一个 Postgres 配置脚本。运行这个脚本,可以进行简单地配置:
|
||||
在 Fedora,CentOS 等类似的版本上,PostgreSQL 安装包中提供了一个 PostgreSQL 配置脚本。运行这个脚本,可以进行简单地配置:
|
||||
|
||||
```
|
||||
$ sudo /usr/bin/postgresql-setup --initdb
|
||||
@ -51,17 +53,17 @@ $ sudo /usr/bin/postgresql-setup --initdb
|
||||
|
||||
#### 其他版本
|
||||
|
||||
最后,如果你是在其他版本上运行的,那么你可以直接使用 Postgres 提供的一些工具。`initdb` 命令会创建一个数据库集群,但是这个命令必须在 `postgres` 用户下运行,你可以使用 `sudo` 来暂时地成为 `postgres` 用户:
|
||||
最后,如果你是在其他版本上运行的,那么你可以直接使用 PostgreSQL 提供的一些工具。`initdb` 命令会创建一个数据库集群,但是这个命令必须在 `postgres` 用户下运行,你可以使用 `sudo` 来暂时地成为 `postgres` 用户:
|
||||
|
||||
```
|
||||
$ sudo -u postgres \
|
||||
"initdb -D /var/lib/pgsql/data \
|
||||
--locale en_US.UTF-8 --auth md5 --pwprompt"
|
||||
"initdb -D /var/lib/pgsql/data \
|
||||
--locale en_US.UTF-8 --auth md5 --pwprompt"
|
||||
```
|
||||
|
||||
### 运行 Postgres
|
||||
### 运行 PostgreSQL
|
||||
|
||||
现在,数据库集群已经存在了,使用 `initdb` 的输出中提供给你的命令或者使用 systemd 启动 Postgres 服务器:
|
||||
现在,数据库集群已经存在了,使用 `initdb` 的输出中提供给你的命令或者使用 systemd 启动 PostgreSQL 服务器:
|
||||
|
||||
```
|
||||
$ sudo systemctl start postgresql
|
||||
@ -99,15 +101,16 @@ Type "help" for help.
|
||||
exampledb=>
|
||||
```
|
||||
|
||||
### 创建一个表
|
||||
#### 创建一个表
|
||||
|
||||
数据库包含很多表。这些表可以可视化为表格,有很多行(在数据库中称为 *记录*)和很多列。行和列的交集称为 *字段*。
|
||||
|
||||
结构化查询语言(SQL)是以它提供的内容而命名的,它能提供可预测且一致的语法,来查询数据库内容,从而收到有用的结果。
|
||||
|
||||
目前,你的数据库是空的,没有任何的表。你可以用 `CTEATE` 语句来创建一个表。结合使用 `IF NOT EXISTS` 是很有用的,它可以避免破坏现有的表。
|
||||
目前,你的数据库是空的,没有任何的表。你可以用 `CREATE` 语句来创建一个表。结合使用 `IF NOT EXISTS` 是很有用的,它可以避免破坏现有的表。
|
||||
|
||||
在你创建一个表之前,想想看你希望这个表包含哪一种数据(在 SQL 术语中称为“数据类型”)。在这个例子中,我创建了一个表,包含两列,有唯一标识符的一列和最多九个字符的可变长的一列。
|
||||
|
||||
```
|
||||
exampledb=> CREATE TABLE IF NOT EXISTS my_sample_table(
|
||||
exampledb(> id SERIAL,
|
||||
@ -117,7 +120,7 @@ exampledb(> wordlist VARCHAR(9) NOT NULL
|
||||
|
||||
关键字 `SERIAL` 并不是一个数据类型。`SERIAL` 是 [PostgreSQL 中的一个特殊的标记][7],它可以创建一个自动递增的整数字段。关键字 `VARCHAR` 是一个数据类型,表示限制内字符数的可变字符。在此例中,我指定了最多 9 个字符。PostgreSQL 中有很多数据类型,因此请参阅项目文档以获取选项列表。
|
||||
|
||||
### 插入数据
|
||||
#### 插入数据
|
||||
|
||||
你可以使用 `INSERT` 语句来给你的新表插入一些样本数据:
|
||||
|
||||
@ -133,7 +136,7 @@ exampledb=> INSERT INTO my_sample_table (WORDLIST) VALUES ('Alexandria');
|
||||
ERROR: VALUE too long FOR TYPE CHARACTER VARYING(9)
|
||||
```
|
||||
|
||||
### 改变表或者列
|
||||
#### 改变表或者列
|
||||
|
||||
当你需要改变一个域的定义时,你可以使用 `ALTER` 这一 SQL 关键字。例如,如果你想改变 `wordlist` 域中最多只能有 9 个字符的限制,你可以重新设置这个数据类型。
|
||||
|
||||
@ -145,20 +148,21 @@ exampledb=> INSERT INTO my_sample_table (WORDLIST) VALUES ('Alexandria');
|
||||
INSERT 0 1
|
||||
```
|
||||
|
||||
### 查询表中的内容
|
||||
#### 查询表中的内容
|
||||
|
||||
SQL 是一种查询语言,因此你可以通过查询来查看数据库的内容。查询可以是很简单的,也可以涉及连接多个不同表之间的复杂关系。要查看表中的所有内容,请使用 `SELECT` 关键字和 `*`(`*` 是通配符):
|
||||
|
||||
SQL 是一种查询语言,因此你可以通过查询来查看数据库的内容。查询可以是很简单的,也可以涉及连接多个不同表之间的复杂关系。要查看表中的所有内容,请使用 `*` 上的 `SELECT` 关键字(`*` 是通配符):
|
||||
```
|
||||
exampledb=> SELECT * FROM my_sample_table;
|
||||
id | wordlist
|
||||
\----+------------
|
||||
----+------------
|
||||
1 | Alice
|
||||
2 | Bob
|
||||
3 | Alexandria
|
||||
(3 ROWS)
|
||||
```
|
||||
|
||||
### 更多信息
|
||||
### 更多数据
|
||||
|
||||
PostgreSQL 可以处理很多数据,但是对于任何数据库来说,关键之处在于你是如何设计你的数据库的,以及数据存储下来之后你是怎么查询数据的。在 [OECD.org][8] 上可以找到一个相对较大的公共数据集,你可以使用它来尝试一些先进的数据库技术。
|
||||
|
||||
@ -166,7 +170,7 @@ PostgreSQL 可以处理很多数据,但是对于任何数据库来说,关键
|
||||
|
||||
在文本编辑器或电子表格应用程序中浏览数据,来了解有哪些列,以及每列包含哪些类型的数据。仔细查看数据,并留意错误情况。例如,`COU` 列指的是国家代码,例如 `AUS` 表示澳大利亚和 `GRC` 表示希腊,在奇怪的 `BRIICS` 之前,这一列的值通常是 3 个字符。
|
||||
|
||||
在你理解了这些数据项后,你就可以准备一个 Postgres 数据库了。
|
||||
在你理解了这些数据项后,你就可以准备一个 PostgreSQL 数据库了。
|
||||
|
||||
```
|
||||
$ createdb landcoverdb --owner bogus
|
||||
@ -195,20 +199,20 @@ flag_codes varchar(1),
|
||||
flag_names varchar(1));
|
||||
```
|
||||
|
||||
### 引入数据
|
||||
#### 引入数据
|
||||
|
||||
Postgres 可以使用特殊的元命令 `\copy` 来直接引入 CSV 数据:
|
||||
|
||||
```
|
||||
landcoverdb=> \copy land_cover from '~/land-cover.csv' with csv header delimiter ','
|
||||
COPY 22113
|
||||
```
|
||||
|
||||
That's 22,113 records imported. Seems like a good start!
|
||||
插入了 22113 条记录。这是一个很好的开始!
|
||||
|
||||
### 查询数据
|
||||
#### 查询数据
|
||||
|
||||
用 `SELECT` 语句可以查询这 22113 条记录的所有列,此外 Postgres 将输出通过管道传输到屏幕上,因此你可以轻松地滚动鼠标来查看输出的结果。更进一步,你可以使用高级SQL,来获得一些有用的视图。
|
||||
用 `SELECT` 语句可以查询这 22113 条记录的所有列,此外 PostgreSQL 将输出通过管道传输到屏幕上,因此你可以轻松地滚动鼠标来查看输出的结果。更进一步,你可以使用高级 SQL 语句,来获得一些有用的视图。
|
||||
|
||||
```
|
||||
landcoverdb=> SELECT
|
||||
@ -240,11 +244,10 @@ ORDER BY country_name,
|
||||
year_value;
|
||||
```
|
||||
|
||||
Here's some sample output:
|
||||
下面是样例的一些输出:
|
||||
|
||||
```
|
||||
\---------------+------------+------------
|
||||
---------------+------------+------------
|
||||
Afghanistan | 2019 | 743.48425
|
||||
Albania | 2019 | 128.82532
|
||||
Algeria | 2019 | 2417.3281
|
||||
@ -260,7 +263,7 @@ SQL 是一种很丰富的语言,超出了本文的讨论范围。通读 SQL
|
||||
|
||||
### 拓展数据库
|
||||
|
||||
PostgreSQL 是伟大的开源数据库之一。有了它,你可以为结构化数据设计存储库,然后使用 SQL 以不同的方式查询它,以便能够获得有关该数据的新视角。Postgres 也能与许多语言集成,包括Python,Lua,Groovy,Java等,因此无论你使用什么工具集,你都可以充分利用好这个出色的数据库。
|
||||
PostgreSQL 是伟大的开源数据库之一。有了它,你可以为结构化数据设计存储库,然后使用 SQL 以不同的方式查询它,以便能够获得有关该数据的新视角。PostgreSQL 也能与许多语言集成,包括 Python、Lua、Groovy、Java 等,因此无论你使用什么工具集,你都可以充分利用好这个出色的数据库。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -269,7 +272,7 @@ via: https://opensource.com/article/22/9/drop-your-database-for-postgresql
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,206 @@
|
||||
[#]: subject: "GUI Apps for Package Management in Arch Linux"
|
||||
[#]: via: "https://itsfoss.com/arch-linux-gui-package-managers/"
|
||||
[#]: author: "Anuj Sharma https://itsfoss.com/author/anuj/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15149-1.html"
|
||||
|
||||
Arch Linux 中用于包管理的图形化应用
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/17/110440isl629s0uqnl8b29.jpg)
|
||||
|
||||
[安装 Arch Linux][1] 有一些挑战性。这就是为什么 [有几个基于 Arch 的发行版][2] 通过提供图形化的安装程序使事情变得简单。
|
||||
|
||||
即使你设法安装了 Arch Linux,你也会注意到它严重依赖命令行。如果你需要安装应用或更新系统,那么必须打开终端。
|
||||
|
||||
是的!Arch Linux 没有软件中心。我知道,这让很多人感到震惊。
|
||||
|
||||
如果你对使用命令行管理应用感到不舒服,你可以安装一个 GUI 工具。这有助于在舒适的图形化界面中搜索包以及安装和删除它们。
|
||||
|
||||
想知道你应该使用 [pacman 命令][3] 的哪个图形前端?我有一些建议可以帮助你。
|
||||
|
||||
**请注意,某些软件管理器是特定于桌面环境的。**
|
||||
|
||||
### 1、Apper
|
||||
|
||||
![使用 Apper 安装 Firefox][4]
|
||||
|
||||
Apper 是一个精简的 Qt5 应用,它使用 PackageKit 进行包管理,它还支持 AppStream 和自动更新。但是,**没有 AUR 支持**。
|
||||
|
||||
要从官方仓库安装它,请使用以下命令:
|
||||
|
||||
```
|
||||
sudo pacman -Syu apper
|
||||
```
|
||||
|
||||
> **[GitLab 上的 Apper][5]**
|
||||
|
||||
### 2、深度应用商店
|
||||
|
||||
![使用深度应用商店安装 Firefox][6]
|
||||
|
||||
深度应用商店是使用 DTK(QT5)构建的深度桌面环境的应用商店,它使用 PackageKit 进行包管理,支持 AppStream,同时提供系统更新通知。 **没有 AUR 支持**。
|
||||
|
||||
要安装它,请使用以下命令:
|
||||
|
||||
```
|
||||
sudo pacman -Syu deepin-store
|
||||
```
|
||||
|
||||
> **[Github 上的深度商店][7]**
|
||||
|
||||
### 3、KDE 发现应用
|
||||
|
||||
![使用 Discover 安装 Firefox][8]
|
||||
|
||||
<ruby>发现<rt>Discover</rt></ruby> 应用不需要为 KDE Plasma 用户介绍。它是一个使用 PackageKit 的基于 Qt 的应用管理器,支持 AppStream、Flatpak 和固件更新。
|
||||
|
||||
要在发现应用中安装 Flatpak 和固件更新,需要分别安装 `flatpak` 和 `fwupd` 包。**它没有 AUR 支持。**
|
||||
|
||||
```
|
||||
sudo pacman -Syu discover packagekit-qt5
|
||||
```
|
||||
|
||||
> **[GitLab 上的 Discover][9]**
|
||||
|
||||
### 4、GNOME PackageKit
|
||||
|
||||
![Installing Firefox using GNOME PackageKit][10]
|
||||
|
||||
GNOME PackageKit 是一个使用 PackageKit 技术的 GTK3 包管理器,支持 AppStream。不幸的是,**没有 AUR 支持**。
|
||||
|
||||
要从官方仓库安装它,请使用以下命令:
|
||||
|
||||
```
|
||||
sudo pacman -Syu gnome-packagekit
|
||||
```
|
||||
|
||||
> **[freedesktop 上的 PackageKit][11]**
|
||||
|
||||
### 5、GNOME 软件应用
|
||||
|
||||
![Installing Firefox using GNOME Software][12]
|
||||
|
||||
GNOME <ruby>软件<rt>Software</rt></ruby> 应用不需要向 GNOME 桌面用户介绍。它是使用 PackageKit 技术的 GTK4 应用管理器,支持 AppStream、Flatpak 和固件更新。
|
||||
|
||||
**它没有 AUR 支持。** 要安装来自 GNOME 软件应用的 Flatpak 和固件更新,需要分别安装 `flatpak` 和 `fwupd` 包。
|
||||
|
||||
安装它使用:
|
||||
|
||||
```
|
||||
sudo pacman -Syu gnome-software-packagekit-plugin gnome-software
|
||||
```
|
||||
|
||||
> **[GitLab 上的 GNOME 软件][13]**
|
||||
|
||||
### 6、tkPacman
|
||||
|
||||
![使用 tkPacman 安装 Firefox][14]
|
||||
|
||||
它是用 Tcl 编写的 Tk pacman 封装。界面类似于 [Synaptic 包管理器][15]。
|
||||
|
||||
由于没有 GTK/Qt 依赖,它非常轻量级,因为它使用 Tcl/Tk GUI 工具包。
|
||||
|
||||
**它不支持 AUR**,这很讽刺,因为你需要从 [AUR][16] 安装它。你需要事先安装一个 [AUR 助手][17],如 yay。
|
||||
|
||||
```
|
||||
yay -Syu tkpacman
|
||||
```
|
||||
|
||||
> **[Sourceforge 上的 tkPacman][18]**
|
||||
|
||||
### 7、Octopi
|
||||
|
||||
![使用 Octopi 安装 Firefox][19]
|
||||
|
||||
可以认为它是 tkPacman 的更好看的表亲。它使用 Qt5 和 Alpm,还支持 Appstream 和 **AUR(通过 yay)**。
|
||||
|
||||
你还可以获得桌面通知、仓库编辑器和缓存清理器。它的界面类似于 Synaptic 包管理器。
|
||||
|
||||
要从 AUR 安装它,请使用以下命令。
|
||||
|
||||
```
|
||||
yay -Syu octopi
|
||||
```
|
||||
|
||||
> **[GitHub 上的 Octopi][20]**
|
||||
|
||||
### 8、Pamac
|
||||
|
||||
![使用 Pamac 安装 Firefox][21]
|
||||
|
||||
Pamac 是 Manjaro Linux 的图形包管理器。它基于 GTK3 和 Alpm,**支持 AUR、Appstream、Flatpak 和 Snap**。
|
||||
|
||||
Pamac 还支持自动下载更新和降级软件包。
|
||||
|
||||
它是 Arch Linux 衍生版中使用最广泛的应用。但因为 [DDoS AUR 网页][22] 而臭名昭著。
|
||||
|
||||
[在 Arch Linux 上安装 Pamac][23] 有几种方法。最简单的方法是使用 AUR 助手。
|
||||
|
||||
```
|
||||
yay -Syu pamac-aur
|
||||
```
|
||||
|
||||
> **[GitLab 上的 Pamac][24]**
|
||||
|
||||
### 总结
|
||||
|
||||
要删除任何上面图形化包管理器以及依赖项和配置文件,请使用以下命令将 `packagename` 替换为要删除的包的名称。
|
||||
|
||||
```
|
||||
sudo pacman -Rns packagename
|
||||
```
|
||||
|
||||
这样看来,Arch Linux 也可以在不接触终端的情况下使用合适的工具。
|
||||
|
||||
还有一些其他应用程序也使用终端用户界面(TUI)。一些例子是 [pcurses][25]、[cylon][26]、[pacseek][27] 和 [yup][28]。但是,这篇文章只讨论那些有适当的 GUI 的软件。
|
||||
|
||||
**注意:** PackageKit 默认打开系统权限,因而 [不推荐][29] 用于一般用途。因为如果用户属于 `wheel` 组,更新或安装任何软件都不需要密码。
|
||||
|
||||
**你看到了在 Arch Linux 上使用图形化软件中心的几种选择。现在是时候决定使用其中一个了。你会选择哪一个?Pamac 或 OctoPi 还是其他?现在就在下面留言吧**。
|
||||
|
||||
---
|
||||
|
||||
via: https://itsfoss.com/arch-linux-gui-package-managers/
|
||||
|
||||
作者:[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/install-arch-linux/
|
||||
[2]: https://itsfoss.com/arch-based-linux-distros/
|
||||
[3]: https://itsfoss.com/pacman-command/
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[5]: https://invent.kde.org/system/apper
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/09/dde-arch-install-firefox.png
|
||||
[7]: https://github.com/dekzi/dde-store
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/09/discover-arch-install-firefox.png
|
||||
[9]: https://invent.kde.org/plasma/discover
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/09/gnome-packagekit-arch-install-firefox.png
|
||||
[11]: https://freedesktop.org/software/PackageKit/index.html
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/09/gnome-software-arch-install-firefox.png
|
||||
[13]: https://gitlab.gnome.org/GNOME/gnome-software
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/09/tkpacman-arch-install-firefox.png
|
||||
[15]: https://itsfoss.com/synaptic-package-manager/
|
||||
[16]: https://itsfoss.com/aur-arch-linux/
|
||||
[17]: https://itsfoss.com/best-aur-helpers/
|
||||
[18]: https://sourceforge.net/projects/tkpacman
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2022/09/octopi-arch-install-firefox.png
|
||||
[20]: https://github.com/aarnt/octopi
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/09/pamac-arch-install-firefox.png
|
||||
[22]: https://gitlab.manjaro.org/applications/pamac/-/issues/1017
|
||||
[23]: https://itsfoss.com/install-pamac-arch-linux/
|
||||
[24]: https://gitlab.manjaro.org/applications/pamac
|
||||
[25]: https://github.com/schuay/pcurses
|
||||
[26]: https://github.com/gavinlyonsrepo/cylon
|
||||
[27]: https://github.com/moson-mo/pacseek
|
||||
[28]: https://github.com/ericm/yup
|
||||
[29]: https://bugs.archlinux.org/task/50459
|
@ -0,0 +1,103 @@
|
||||
[#]: subject: "Get change alerts from any website with this open source tool"
|
||||
[#]: via: "https://opensource.com/article/22/9/changedetection-io-open-source-website-changes"
|
||||
[#]: author: "Leigh Morresi https://opensource.com/users/dgtlmoon"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15129-1.html"
|
||||
|
||||
用这个开源工具从任何网站获取变化提醒
|
||||
======
|
||||
|
||||
> 使用 changedetection.io 在网站发生变化或更新时获得提醒。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/11/153605ikpi81s1mz8wak2z.jpg)
|
||||
|
||||
那一年是 2020 年,关于大流行病的消息迅速涌来,每个人都感到完全被类似的新闻文章所淹没,提供了不同程度的更新。
|
||||
|
||||
但我需要知道的是,我们的官方准则何时改变。最后,这就是对我来说最重要的事情。
|
||||
|
||||
无论关注的是大流行病还是最新的科技新闻,提前了解网站内容的变化都至关重要。
|
||||
|
||||
[changedetection.io][2] 项目为网站变更检测和通知提供了一个简单但强大的开源解决方案。它很容易设置,而且可以通知 70 多个(还在不断增加)不同的通知系统,如 Matrix、Mattermost、[Nextcloud][3]、[Signal][4]、[Zulip][5]、[Home Assistant][6]、电子邮件等等。它还能通知专有应用,如 Discord、Office365、Reddit、Telegram 和许多其他应用。
|
||||
|
||||
但 [changedetection.io][7] 并不只是局限于观察网页内容。你也可以监视 XML 和 JSON 源,它将建立一个 RSS 馈送,记录变化的网站。
|
||||
|
||||
由于其内置的 JSON 简单存储系统,不需要设置复杂的数据库来接收和存储信息。你可以 [使用 Docker 镜像运行][8] 或用 `pip` 安装它。该项目有一个 [全面的维基帮助页][9],大多数常见的问题都有涵盖。
|
||||
|
||||
对于使用复杂 JavaScript 的网站,你可以用内置的 [Playwright 内容获取器][10] 将你的 changedetection.io 连接到 Chromium 或 Chrome 浏览器。
|
||||
|
||||
运行后,在你的浏览器(默认情况下是 `http://localhost:5000`)中访问该应用。如果你的电脑可以从外部网络访问,你可以在 <ruby>设置<rt>Settings</rt></ruby>中设置一个密码。
|
||||
|
||||
![change detection watch list][11]
|
||||
|
||||
提交你想监控的页面的 URL。有几个与如何过滤该网页有关的设置。例如,你很可能不想知道一家公司在其网站页脚列出的股票价格何时发生变化,但你可能想知道他们在其博客上发布的新闻文章。
|
||||
|
||||
### 监控一个网站
|
||||
|
||||
想象一下,你想添加你最喜欢的网站 Opensource.com 进行监控。你只想知道主要标注文章何时包含 “python” 一词,并且通过 Matrix 收到通知。
|
||||
|
||||
要做到这点,首先要使用“<ruby>视觉选择器<rt>Visual Filter Selector</rt></ruby>”工具。(这需要连接 **playwright** 浏览器界面)。
|
||||
|
||||
![Find an element to monitor][12]
|
||||
|
||||
该工具会自动计算出针对内容的最佳 Xpath 或 CSS 过滤器。否则,你会从每天的页面更新中得到大量的噪音。
|
||||
|
||||
接下来,访问“<ruby>过滤器和触发器<rt>Filters & Triggers</rt></ruby>”标签。
|
||||
|
||||
![Filters and triggers][13]
|
||||
|
||||
在 “<ruby>CSS/JSON/XPATH 过滤器<rt>CSS/JSON/XPATH Filter</rt></ruby>”区域(蓝色圆圈),你可以看到上一步自动生成的 CSS 过滤器。
|
||||
|
||||
有几个有用的过滤器,比如“<ruby>移除元素<rt>Remove elements</rt></ruby>”(适合移除嘈杂的元素)、“<ruby>忽略文本<rt>Ignore text</rt></ruby>”、“<ruby>触发/等待文本<rt>Trigger/wait for text</rt></ruby>”,和“<ruby>如果文本匹配则阻止变化检测<rt>Block change-detection if text matches</rt></ruby>”(用于等待一些文本消失,如“售罄”)。
|
||||
|
||||
在“<ruby>触发/等待文本<rt>Trigger/wait for text</rt></ruby>”(红色圆圈)中,输入你想监测的关键词。(在这个例子中是 “python”)。
|
||||
|
||||
最后一步是在“<ruby>通知<rt>Notifications</rt></ruby>”选项卡中,你要在那里配置你想收到的通知。下面我使用 Matrix API 添加了一个 Matrix 房间作为通知目标。
|
||||
|
||||
![Notifications tab][14]
|
||||
|
||||
通知的 URL 的格式是 `matrixs://username:password@matrix.org/#/room/#room-name:matrix.org`。
|
||||
|
||||
然而,[t2Bot][15] 格式也支持。这里有更多的 [Matrix 通知选项][16]。
|
||||
|
||||
就是这些了! 现在只要内容有变化,你就会通过 Matrix 收到信息。
|
||||
|
||||
### 还有更多
|
||||
|
||||
changedetection.io 还有很多东西。如果你喜欢调用一个自定义的 JSON API,你不需要使用通知的 API(使用 `jsons://` )。你还可以创建一个自定义的 HTTP 请求(POST 和 GET),在检查前执行 JavaScript(也许是为了预先填充一个用户名和密码的登录字段),以及更多有趣的功能,更多的功能将陆续推出。
|
||||
|
||||
不要再浏览网站,而是开始监测网络吧!
|
||||
|
||||
*图片提供:(Leigh Morresi, CC BY-SA 4.0)*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/changedetection-io-open-source-website-changes
|
||||
|
||||
作者:[Leigh Morresi][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/dgtlmoon
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/browser_desktop_website_checklist_metrics.png
|
||||
[2]: https://github.com/dgtlmoon/changedetection.io
|
||||
[3]: https://opensource.com/tags/nextcloud
|
||||
[4]: https://opensource.com/article/19/10/secure-private-messaging
|
||||
[5]: https://opensource.com/article/22/3/open-source-chat-zulip
|
||||
[6]: https://opensource.com/article/20/11/home-assistant
|
||||
[7]: https://github.com/dgtlmoon/changedetection.io
|
||||
[8]: https://github.com/dgtlmoon/changedetection.io#docker
|
||||
[9]: https://github.com/dgtlmoon/changedetection.io/wiki
|
||||
[10]: https://github.com/dgtlmoon/changedetection.io/wiki/Playwright-content-fetcher
|
||||
[11]: https://opensource.com/sites/default/files/2022-09/screenshot.png
|
||||
[12]: https://opensource.com/sites/default/files/2022-09/changedetect-osdc.png
|
||||
[13]: https://opensource.com/sites/default/files/2022-09/changedetect-filters-triggers.webp
|
||||
[14]: https://opensource.com/sites/default/files/2022-09/step3-notification-matrix.png
|
||||
[15]: https://t2bot.io/
|
||||
[16]: https://github.com/caronc/apprise/wiki/Notify_matrix
|
@ -3,19 +3,22 @@
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15137-1.html"
|
||||
|
||||
如何在 Brave 浏览器中使用画中画模式
|
||||
======
|
||||
Brave 是一款出色的类似于 Chrome, 但可[替代 Chrome 的网络浏览器][1]。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/13/003034agqsflug771cl3uj.jpg)
|
||||
|
||||
> Brave 是一款出色的类似于 Chrome,但可 [替代 Chrome 的网络浏览器][1]。
|
||||
|
||||
[Firefox 和 Brave][2] 是我喜欢在 Linux 系统上使用的两种浏览器。两者都有不同的优势。
|
||||
|
||||
Firefox 比 Brave 做得更好的一件事就是画中画 (PIP) 模式,它适用于 YouTube、Netflix 和大多数流媒体网站。
|
||||
Firefox 比 Brave 做得更好的一件事就是画中画(PIP)模式,它适用于 YouTube、Netflix 和大多数流媒体网站。
|
||||
|
||||
Brave 也有画中画模式,但它是如此隐藏,以至于你觉得根本没有 PIP 支持。
|
||||
Brave 也有画中画模式,但它是如此隐藏,以至于你觉得它根本没有 PIP 支持。
|
||||
|
||||
内置画中画适用于某些网站(如 YouTube),但可能不适用于其他网站(如 Prime Video)。不用担心!你可以为此使用专用扩展。
|
||||
|
||||
@ -29,7 +32,7 @@ Brave 也有画中画模式,但它是如此隐藏,以至于你觉得根本
|
||||
|
||||
![第一次右键单击后将光标从上下文菜单稍微移开][3]
|
||||
|
||||
再次右键单击。它应该在视频上,但不在上一个上下文菜单上。就在视频的其他地方。
|
||||
再次右键单击。它应该在视频上,但不在上一个上下文菜单上,而在视频的其他地方。
|
||||
|
||||
现在你应该看到另一个带有画中画选项的上下文菜单。
|
||||
|
||||
@ -43,7 +46,7 @@ Brave 也有画中画模式,但它是如此隐藏,以至于你觉得根本
|
||||
|
||||
![Brave 在画中画模式中播放影片][6]
|
||||
|
||||
在最近的 Brave 版本中,您可以根据自己的喜好调整弹出窗口的大小。
|
||||
在最近的 Brave 版本中,你可以根据自己的喜好调整弹出窗口的大小。
|
||||
|
||||
我不明白为什么 Brave 把它隐藏成这样。为什么不突出它?
|
||||
|
||||
@ -51,11 +54,11 @@ Brave 也有画中画模式,但它是如此隐藏,以至于你觉得根本
|
||||
|
||||
### 方法 2:使用画中画扩展
|
||||
|
||||
Google 提供了一个官方插件,可让你在 Google Chrome 中获得画中画功能。由于 Brave 基于 Chromium,你可以在 Brave 中使用相同的扩展。
|
||||
谷歌提供了一个官方插件,可让你在谷歌 Chrome 中获得画中画功能。由于 Brave 基于 Chromium,你可以在 Brave 中使用相同的扩展。
|
||||
|
||||
[画中画扩展][7]
|
||||
> **[画中画扩展][7]**
|
||||
|
||||
进入扩展页面并**点击 Add to Brave 按钮**。
|
||||
进入扩展页面并点击 “<ruby>添加到 Brave<rt>Add to Brave</rt></ruby>” 按钮。
|
||||
|
||||
![为 Brave 添加画中画扩展][8]
|
||||
|
||||
@ -67,7 +70,7 @@ Google 提供了一个官方插件,可让你在 Google Chrome 中获得画中
|
||||
|
||||
![使用画中画扩展][10]
|
||||
|
||||
播放视频时,单击扩展名,视频应该会弹出。
|
||||
播放视频时,单击该扩展图标,视频应该会弹出。
|
||||
|
||||
### 你能在 Brave 中启用 PIP 模式吗?
|
||||
|
||||
@ -82,7 +85,7 @@ via: https://itsfoss.com/picture-in-picture-brave/
|
||||
作者:[Abhishek Prakash][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/) 荣誉推出
|
||||
|
||||
@ -90,7 +93,7 @@ via: https://itsfoss.com/picture-in-picture-brave/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/open-source-browsers-linux/
|
||||
[2]: https://itsfoss.com/brave-vs-firefox/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/09/getting-picture-in-picture-in-brave-1.png
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/09/getting-picture-in-picture-in-brave-1.webp
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/09/getting-picture-in-picture-in-brave-2.webp
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/09/brave-picture-in-picture-youtube.webp
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/09/brave-playing-picture-in-picture-mode-on-screen.webp
|
@ -0,0 +1,206 @@
|
||||
[#]: subject: "How to Enable RPM Fusion Repo in Fedora, CentOS, RHEL"
|
||||
[#]: via: "https://www.debugpoint.com/enable-rpm-fusion-fedora-rhel-centos/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15145-1.html"
|
||||
|
||||
如何在 Fedora、CentOS、RHEL 中启用 RPM Fusion 仓库
|
||||
======
|
||||
|
||||
> 本指南解释了在 Fedora Linux 发行版中启用第三方软件仓库 RPM Fusion 的步骤。
|
||||
|
||||
[RPM Fusion][1] 软件仓库是一个社区维护的软件仓库,它为 Fedora Linux 提供额外的软件包,这些软件包不是由 Fedora 官方团队分发,例如 DVD 播放、媒体播放、来自 GNOME 和 KDE 的软件等。这是因为许可证、其他法律原因和特定国家/地区的软件规范而导致的。
|
||||
|
||||
RPM Fusion 为 Red Hat Enterprise Linux(RHEL)以及 Fedora 提供了 .rpm 包。
|
||||
|
||||
本指南介绍了在 Fedora Linux 中启用 RPM Fusion 仓库所需的步骤。本指南适用于所有 Fedora 发行版本。
|
||||
|
||||
这在所有当前支持的 Fedora 版本(35、36 和 37)中进行了测试。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/16/111338jjr0eh5cjgq017n5.jpg)
|
||||
|
||||
### 如何在 Fedora Linux、RHEL、CentOS 中启用 RPM Fusion 仓库
|
||||
|
||||
RPM Fusion 有两种版本的仓库:自由和非自由。
|
||||
|
||||
顾名思义,自由版包含软件包的自由版本,非自由版包含封闭源代码的编译软件包和“非商业”开源软件。
|
||||
|
||||
在继续之前,首先检查你是否安装了 RPM fusion。打开终端并运行以下命令。
|
||||
|
||||
```
|
||||
dnf repolist | grep rpmfusion
|
||||
```
|
||||
|
||||
如果安装了 RPM,你应该会看到如下所示的消息。就不用下面的步骤。如果未安装,你可以继续执行以下步骤。
|
||||
|
||||
![RPM Fusion 已安装][3]
|
||||
|
||||
打开终端并根据你的操作系统版本运行以下命令。请注意,这些命令包含自由和非自由版本。如果你愿意,你可以在运行时省略下面的任何一个。
|
||||
|
||||
#### Fedora
|
||||
|
||||
自由版:
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
非自由版:
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
#### 在 Silverblue 上使用 rpm-ostree
|
||||
|
||||
自由版:
|
||||
|
||||
```
|
||||
sudo rpm-ostree install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
非自由版:
|
||||
|
||||
```
|
||||
sudo rpm-ostree install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
#### RHEL 8
|
||||
|
||||
先安装 EPEL:
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
```
|
||||
|
||||
自由版:
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
非自由版:
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheckhttps://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
开发相关软件包:
|
||||
|
||||
```
|
||||
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(uname -m)-rpms"
|
||||
```
|
||||
|
||||
#### CentOS 8
|
||||
|
||||
先安装 EPEL:
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
```
|
||||
|
||||
自由版:
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
非自由版:
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheckhttps://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
启用 PowerTools:
|
||||
|
||||
```
|
||||
sudo dnf config-manager --enable PowerTools
|
||||
```
|
||||
|
||||
### 附加说明
|
||||
|
||||
RPM Fusion 还可以帮助用户安装来自 GNOME 软件或 KDE Discover 的软件包。要在 Fedora 中启用它,请运行以下命令:
|
||||
|
||||
```
|
||||
sudo dnf groupupdate core
|
||||
```
|
||||
|
||||
你还可以通过以下命令启用 RPM Fusion 来使用 gstreamer 和其他多媒体播放包来播放媒体文件。
|
||||
|
||||
```
|
||||
sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf groupupdate sound-and-video
|
||||
```
|
||||
|
||||
启用 RPM Fusion 以使用 libdvdcss 播放 DVD。
|
||||
|
||||
```
|
||||
sudo dnf install rpmfusion-free-release-taintedsudo dnf install libdvdcss
|
||||
```
|
||||
|
||||
通过以下命令启用 RPM Fusion 以启用非 FLOSS 硬件包。
|
||||
|
||||
```
|
||||
sudo dnf install rpmfusion-nonfree-release-taintedsudo dnf install *-firmware
|
||||
```
|
||||
|
||||
运行命令后,如果你使用的是 Fedora 或 CentOS/RHEL,请在重启前运行以下命令。
|
||||
|
||||
```
|
||||
sudo dnf check-updatesudo dnf update
|
||||
```
|
||||
|
||||
### 如何使用 dnf 删除仓库
|
||||
|
||||
如果要删除仓库,请按照以下步骤操作。
|
||||
|
||||
首先,使用以下命令查看添加到 Fedora 系统的仓库列表。
|
||||
|
||||
```
|
||||
dnf repolist
|
||||
```
|
||||
|
||||
![dnf 仓库列表][4]
|
||||
|
||||
如你所见,添加了 rpmfusion 自由和非自由仓库。要通过 dnf 删除它,你需要使用以下命令准确知道仓库文件名。
|
||||
|
||||
```
|
||||
rpm -qa 'rpmfusion*'
|
||||
```
|
||||
|
||||
这将列出仓库的确切名称。在示例中,它们是 “rpmfusion-free-release”。
|
||||
|
||||
![从 Fedora 中移除 rpmfusion][5]
|
||||
|
||||
现在你可以简单地运行以下命令来删除它。
|
||||
|
||||
```
|
||||
sudo dnf remove rpmfusion-free-release
|
||||
```
|
||||
|
||||
你可以重复上面的例子从 Fedora 中删除 rpmfusion,也可以使用它从系统中删除任何其他仓库。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/enable-rpm-fusion-fedora-rhel-centos/
|
||||
|
||||
作者:[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://rpmfusion.org/
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2020/07/rpmfusion.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2020/07/RPM-Fusion-Already-Installed-.png
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2020/07/dnf-repolist.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2020/07/remove-rpmfusion-from-fedora.jpg
|
@ -3,52 +3,55 @@
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15134-1.html"
|
||||
|
||||
使用 Topgrade 一次升级 Linux 中的各种软件包
|
||||
======
|
||||
更新 Linux 系统并没有那么复杂,不是吗?毕竟,要像发行版一样更新 Ubuntu,你只需要使用 apt update 和 apt upgrade。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/12/152118mo5r6pohnn4o5h56.jpg)
|
||||
|
||||
更新 Linux 系统并没有那么复杂,不是吗?毕竟,要更新 Ubuntu 之类的发行版,你只需要使用 `apt update` 和 `apt upgrade` 就行。
|
||||
|
||||
如果所有的包都是通过一个包管理器安装的,就会是这样。
|
||||
|
||||
但现在情况不再如此。你有经典的 apt/dnf/pacman,还有 snap、flatpak、appimages。不止于此,你还可以使用 PIP(用于 Python)和 Cargo(用于 Rust)安装应用。
|
||||
但现在情况不再如此。你有经典的 apt/dnf/pacman,还有 Snap、Flatpak、Appimages。不止于此,你还可以使用 PIP(用于 Python)和 Cargo(用于 Rust)安装应用。
|
||||
|
||||
使用 node? npm 包需要单独更新。Oh My Zsh?需要单独更新。[Vim 中的插件][1]、Atom 等也可能不被 apt/dnf/pacman 覆盖。
|
||||
使用 Node? NPM 包需要单独更新。Oh My Zsh?需要单独更新。[Vim 中的插件][1]、Atom 等也可能不被 apt/dnf/pacman 覆盖。
|
||||
|
||||
你现在看到问题了吗?这就是名为 topgrade 的新工具旨在解决的问题。
|
||||
你现在看到问题了吗?这就是名为 Topgrade 的新工具旨在解决的问题。
|
||||
|
||||
### Topgrade:处理各种更新的单一程序
|
||||
|
||||
[topgrade][2] 是一个 CLI 程序,它会检测你使用的工具,然后运行适当的命令来更新它们。
|
||||
[Topgrade][2] 是一个 CLI 程序,它会检测你使用的工具,然后运行适当的命令来更新它们。
|
||||
|
||||
![topgrade disable system][3]
|
||||
![Topgrade disable system][3]
|
||||
|
||||
除了通常的 Linux 包管理器,它还可以检测和更新 brew、cargo、PIP、pihole、Vim 和 Emacs 插件、R 软件包等。你可以在 [wiki 页面][4]上查看支持的包列表。
|
||||
除了通常的 Linux 包管理器,它还可以检测和更新 Brew、Cargo、PIP、Pihole、Vim 和 Emacs 插件、R 软件包等。你可以在 [维基页面][4] 上查看支持的包列表。
|
||||
|
||||
##### Topgrade 的主要特点:
|
||||
|
||||
* 能够从不同的包管理器更新包,包括固件!
|
||||
* 你可以控制更新包的方式。
|
||||
* 能够更新来自不同的包管理器的软件包,**包括固件**!
|
||||
* 你可以如何控制更新包。
|
||||
* 高度可定制。
|
||||
* 能够在更新包之前进行概览
|
||||
* 甚至能够在更新包之前进行概览。
|
||||
|
||||
所以不要浪费任何时间,让我们跳到安装。
|
||||
|
||||
### 使用 Cargo 在 Linux 中安装 Topgrade
|
||||
|
||||
安装过程非常简单,因为我将使用 cargo 包管理器。
|
||||
安装过程非常简单,因为我将使用 Cargo 包管理器。
|
||||
|
||||
我们已经有了[详细指南,其中包含设置 cargo 包管理器的多种方法][5]。所以我将在我的示例中使用 Ubuntu 来快速完成。
|
||||
我们已经有了 [详细指南,其中包含设置 Cargo 包管理器的多种方法][5]。所以我将在我的示例中使用 Ubuntu 来快速完成。
|
||||
|
||||
因此,让我们以最少方式安装依赖项以及 cargo:
|
||||
因此,让我们以最少方式安装依赖项以及 Cargo:
|
||||
|
||||
```
|
||||
sudo apt install cargo libssl-dev pkg-config
|
||||
```
|
||||
|
||||
安装 cargo 后,使用给定的命令安装 topgrade:
|
||||
安装 Cargo 后,使用给定的命令安装 Topgrade:
|
||||
|
||||
```
|
||||
cargo install topgrade
|
||||
@ -58,13 +61,13 @@ cargo install topgrade
|
||||
|
||||
![cargo error][6]
|
||||
|
||||
你只需添加 cargo 路径即可运行二进制文件。这可以通过给定的命令来完成,你需要使用你的用户名替换 `sagar`:
|
||||
你只需添加 `cargo` 路径即可运行二进制文件。这可以通过给定的命令来完成,你需要使用你的用户名替换 `sagar`:
|
||||
|
||||
```
|
||||
echo 'export PATH=$PATH:/home/sagar/.cargo/bin' >> /home/sagar/.bashrc
|
||||
```
|
||||
|
||||
现在,重启系统,topgrade 就可以使用了。但是等等,我们需要安装另一个包来更新 cargo 以获取最新的包。
|
||||
现在,重启系统,Topgrade 就可以使用了。但是等等,我们需要安装另一个包来更新 Cargo 以获取最新的包。
|
||||
|
||||
```
|
||||
cargo install cargo-update
|
||||
@ -74,7 +77,7 @@ cargo install cargo-update
|
||||
|
||||
### 使用 Topgrade
|
||||
|
||||
使用 topgrade 非常简单。使用一个命令,就是这样:
|
||||
使用 Topgrade 非常简单。使用一个命令,就是这样:
|
||||
|
||||
```
|
||||
topgrade
|
||||
@ -86,13 +89,13 @@ topgrade
|
||||
|
||||
#### 从 Topgrade 中排除包管理器和仓库
|
||||
|
||||
假设我想排除 snap 和从默认包管理器下载的包,所以我的命令是:
|
||||
假设我想排除 Snap 和从默认包管理器下载的包,所以我的命令是:
|
||||
|
||||
```
|
||||
topgrade --disable snap system
|
||||
```
|
||||
|
||||
![topgrade disable snap system][8]
|
||||
![Topgrade disable snap system][8]
|
||||
|
||||
要进行永久更改,你必须在其配置文件中进行一些更改,这些更改可以通过给定的命令访问:
|
||||
|
||||
@ -100,29 +103,29 @@ topgrade --disable snap system
|
||||
topgrade --edit-config
|
||||
```
|
||||
|
||||
对于此示例,我排除了 snap 和默认系统仓库:
|
||||
对于此示例,我排除了 Snap 和默认系统仓库:
|
||||
|
||||
![configuring topgrade][9]
|
||||
![configuring Topgrade][9]
|
||||
|
||||
#### 试运行 topgrade
|
||||
#### 试运行 Topgrade
|
||||
|
||||
评估将要更新的过时软件包总是一个好主意,我从 topgrade 的整个目录中找到了这个最有用的选项。
|
||||
评估将要更新的过时软件包总是一个好主意,我从 Topgrade 的整个目录中找到了这个最有用的选项。
|
||||
|
||||
你只需使用带有 `-n` 选项的 topgrade,它就会生成过期软件包的摘要。
|
||||
你只需使用带有 `-n` 选项的 `topgrade` 命令,它就会生成过期软件包的摘要。
|
||||
|
||||
```
|
||||
topgrade -n
|
||||
```
|
||||
|
||||
![summery of topgrade][10]
|
||||
![summery of Topgrade][10]
|
||||
|
||||
检查需要更新的软件包的一种简洁方法。
|
||||
|
||||
### 最后的话
|
||||
### 总结
|
||||
|
||||
在使用 Topgrade 几周后,它成为了我的 Linux 武器库中不可或缺的一部分。 像大多数其他 Linux 用户一样,我只是通过我的默认包管理器更新包。 Python 和 Rust 包被完全忽略了。 感谢 topgrade,我的系统现在完全更新了。
|
||||
在使用 Topgrade 几周后,它成为了我的 Linux 武器库中不可或缺的一部分。 像大多数其他 Linux 用户一样,我只是通过我的默认包管理器更新包。 Python 和 Rust 包被完全忽略了。 感谢 Topgrade,我的系统现在完全更新了。
|
||||
|
||||
我知道这不是每个人都想使用的工具。 那你呢? 愿意试一试吗?
|
||||
我知道这不是每个人都想使用的工具。那你呢?愿意试一试吗?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -131,7 +134,7 @@ via: https://itsfoss.com/topgrade/
|
||||
作者:[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/) 荣誉推出
|
||||
|
@ -0,0 +1,218 @@
|
||||
[#]: subject: "How to Create LVM Partition Step-by-Step in Linux"
|
||||
[#]: via: "https://www.linuxtechi.com/how-to-create-lvm-partition-in-linux/"
|
||||
[#]: author: "James Kiarie https://www.linuxtechi.com/author/james/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15152-1.html"
|
||||
|
||||
在 Linux 中创建 LVM 分区的分步指南
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202210/18/113615swffwazya3nyfve2.jpg)
|
||||
|
||||
> 在本指南中,我们将逐步介绍如何在 Linux 中创建 LVM 分区。
|
||||
|
||||
LVM 代表 “<ruby>逻辑卷管理<rt>Logical Volume Management</rt></ruby>”,它是专门为服务器管理 Linux 系统上的磁盘或存储的推荐方式。 LVM 分区的主要优点之一是我们可以实时扩展其大小而无需停机。 LVM 分区也可以缩小,但不推荐。
|
||||
|
||||
为了演示,我在我的 Ubuntu 22.04 系统上连接了 15GB 磁盘,我们将从命令行在该磁盘上创建 LVM 分区。
|
||||
|
||||
##### 准备
|
||||
|
||||
- 连接到 Linux 系统的原始磁盘
|
||||
- 具有 sudo 权限的本地用户
|
||||
- 预装 lvm2 包
|
||||
|
||||
事不宜迟,让我们深入了解这些步骤。
|
||||
|
||||
### 步骤 1、识别新连接的原始磁盘
|
||||
|
||||
登录到你的系统,打开终端并运行以下 `dmesg` 命令:
|
||||
|
||||
```
|
||||
$ sudo dmesg | grep -i sd
|
||||
```
|
||||
|
||||
在输出中,查找大小为 15GB 的新磁盘。
|
||||
|
||||
![dmesg-command-new-attached-disk-linux][1]
|
||||
|
||||
识别新连接的原始磁盘的另一种方法是通过 `fdisk` 命令:
|
||||
|
||||
```
|
||||
$ sudo fdisk -l | grep -i /dev/sd
|
||||
```
|
||||
|
||||
输出:
|
||||
|
||||
![fdisk-command-output-new-disk][2]
|
||||
|
||||
从上面的输出,可以确认新连接的磁盘是 `/dev/sdb`。
|
||||
|
||||
### 步骤 2、创建 PV(物理卷)
|
||||
|
||||
在开始在磁盘 `/dev/sdb` 上创建<ruby>物理卷<rt>Physical Volume</rt></ruby>(PV)之前,请确保已安装 `lvm2` 包。如果未安装,请运行以下命令:
|
||||
|
||||
```
|
||||
$ sudo apt install lvm2 // On Ubuntu / Debian
|
||||
$ sudo dnf install lvm2 // on RHEL / CentOS
|
||||
```
|
||||
|
||||
运行以下 `pvcreate` 命令在磁盘 `/dev/sdb` 上创建 PV:
|
||||
|
||||
```
|
||||
$ sudo pvcreate /dev/sdb
|
||||
Physical volume "/dev/sdb" successfully created.
|
||||
$
|
||||
```
|
||||
|
||||
要验证 PV 状态,运行:
|
||||
|
||||
```
|
||||
$ sudo pvs /dev/sdb
|
||||
或者
|
||||
$ sudo pvdisplay /dev/sdb
|
||||
```
|
||||
|
||||
![pvdisplay-command-output-linux][3]
|
||||
|
||||
### 步骤 3、创建 VG(卷组)
|
||||
|
||||
要创建<ruby>卷组<rt>Volume Group</rt></ruby>(VG),我们将使用 `vgcreate` 命令。创建 VG 意味着将 PV 添加到其中。
|
||||
|
||||
语法:
|
||||
|
||||
```
|
||||
$ sudo vgcreare <vg_name> <pv>
|
||||
```
|
||||
|
||||
在我们的例子中,命令是:
|
||||
|
||||
```
|
||||
$ sudo vgcreate volgrp01 /dev/sdb
|
||||
Volume group "volgrp01" successfully created
|
||||
$
|
||||
```
|
||||
|
||||
运行以下命令以验证 VG(`volgrp01`)的状态:
|
||||
|
||||
```
|
||||
$ sudo vgs volgrp01
|
||||
或者
|
||||
$ sudo vgdisplay volgrp01
|
||||
```
|
||||
|
||||
上述命令的输出:
|
||||
|
||||
![vgs-command-output-linux][4]
|
||||
|
||||
以上输出确认大小为 15 GiB 的卷组 `volgrp01` 已成功创建,一个<ruby>物理扩展<er>Physical Extend</rt></ruby>(PE)的大小为 4 MB。创建 VG 时可以更改 PE 大小。
|
||||
|
||||
### 步骤 4、创建 LV(逻辑卷)
|
||||
|
||||
`lvcreate` 命令用于从 VG 中创建<ruby>逻辑卷<rt>Logical Volume</rt></ruby> LV。 `lvcreate` 命令的语法如下所示:
|
||||
|
||||
```
|
||||
$ sudo lvcreate -L <Size-of-LV> -n <LV-Name> <VG-Name>
|
||||
```
|
||||
|
||||
在我们的例子中,以下命令将用于创建大小为 14 GB 的 LV:
|
||||
|
||||
```
|
||||
$ sudo lvcreate -L 14G -n lv01 volgrp01
|
||||
Logical volume "lv01" created.
|
||||
$
|
||||
```
|
||||
|
||||
验证 LV 的状态,运行:
|
||||
|
||||
```
|
||||
$ sudo lvs /dev/volgrp01/lv01
|
||||
或者
|
||||
$ sudo lvdisplay /dev/volgrp01/lv01
|
||||
```
|
||||
|
||||
输出:
|
||||
|
||||
![lvs-command-output-linux][5]
|
||||
|
||||
上面的输出显示 LV(`lv01`)已成功创建,大小为 14 GiB。
|
||||
|
||||
### 步骤 5、格式化 LVM 分区
|
||||
|
||||
使用 `mkfs` 命令格式化 LVM 分区。在我们的例子中,LVM 分区是 `/dev/volgrp01/lv01`。
|
||||
|
||||
注意:我们可以将分区格式化为 ext4 或 xfs,因此请根据你的设置和要求选择文件系统类型。
|
||||
|
||||
运行以下命令将 LVM 分区格式化为 ext4 文件系统。
|
||||
|
||||
```
|
||||
$ sudo mkfs.ext4 /dev/volgrp01/lv01
|
||||
```
|
||||
|
||||
![mkfs-ext4-filesystem-lvm][6]
|
||||
|
||||
执行下面的命令,用 xfs 文件系统格式化 LVM 分区:
|
||||
|
||||
```
|
||||
$ sudo mkfs.xfs /dev/volgrp01/lv01
|
||||
```
|
||||
|
||||
要使用上述格式化分区,我们必须将其挂载到某个文件夹中。所以,让我们创建一个文件夹 `/mnt/data`:
|
||||
|
||||
```
|
||||
$ sudo mkdir /mnt/data
|
||||
```
|
||||
|
||||
现在运行 `mount` 命令将其挂载到 `/mnt/data` 文件夹:
|
||||
|
||||
```
|
||||
$ sudo mount /dev/volgrp01/lv01 /mnt/data/
|
||||
$ df -Th /mnt/data/
|
||||
Filesystem Type Size Used Avail Use% Mounted on
|
||||
/dev/mapper/volgrp01-lv01 ext4 14G 24K 13G 1% /mnt/data
|
||||
$
|
||||
```
|
||||
|
||||
尝试创建一些没用的文件,运行以下命令:
|
||||
|
||||
```
|
||||
$ cd /mnt/data/
|
||||
$ echo "testing lvm partition" | sudo tee dummy.txt
|
||||
$ cat dummy.txt
|
||||
testing lvm partition
|
||||
$
|
||||
$ sudo rm -f dummy.txt
|
||||
```
|
||||
|
||||
完美,以上命令输出确认我们可以访问 LVM 分区。
|
||||
|
||||
要永久挂载上述 LVM 分区,请使用以下 `echo` 命令将其条目添加到 `fstab` 文件中:
|
||||
|
||||
```
|
||||
$ echo '/dev/volgrp01/lv01 /mnt/data ext4 defaults 0 0' | sudo tee -a /etc/fstab
|
||||
$ sudo mount -a
|
||||
```
|
||||
|
||||
以上就是本指南的全部内容,感谢阅读。请在下面的评论区发表你的问题和反馈。
|
||||
|
||||
---
|
||||
|
||||
via: https://www.linuxtechi.com/how-to-create-lvm-partition-in-linux/
|
||||
|
||||
作者:[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/2022/10/dmesg-command-new-attached-disk-linux.png
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2022/10/fdisk-command-output-new-disk.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2022/10/pvdisplay-command-output-linux.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2022/10/vgs-command-output-linux.png
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2022/10/lvs-command-output-linux.png
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2022/10/mkfs-ext4-filesystem-lvm.png
|
@ -0,0 +1,106 @@
|
||||
[#]: subject: "VirtualBox 7.0 Releases With Secure Boot and Full VM Encryption Support"
|
||||
[#]: via: "https://news.itsfoss.com/virtualbox-7-0-release/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15141-1.html"
|
||||
|
||||
VirtualBox 7.0 发布,支持安全启动和全加密虚拟机
|
||||
======
|
||||
|
||||
> VirtualBox 7.0 是自其上次大版本更新以来的一次重大升级。有一些不错的进步!
|
||||
|
||||
![伴随着 VirtualBox 7.0 的发布,支持安全启动和全加密虚拟机][1]
|
||||
|
||||
对 VirtualBox 来说,这是一次大的升级。这个版本值得关注,因为我们在最近几年没有看到过它的大版本更新。
|
||||
|
||||
对于那些不熟悉 VirtualBox 的人来说,它是一个由 [甲骨文公司][2] 开发的虚拟化软件。
|
||||
|
||||
随着 VirtualBox 7.0 的推出,增加了许多新功能。
|
||||
|
||||
让我们来看看其中最关键的一些。
|
||||
|
||||
### VirtualBox 7.0 的新内容
|
||||
|
||||
![virtualbox 7.0][3]
|
||||
|
||||
VirtualBox 7.0 是一次有益的升级。有图标更新、主题改进,以及一些关键的亮点,包括:
|
||||
|
||||
* 一个显示运行中的<ruby>客体<rt>Guest</rt></ruby>的性能统计的新工具。
|
||||
* 支持安全启动。
|
||||
* 支持<ruby>全加密虚拟机<rt>Full VM Encryption</rt></ruby>(通过 CLI)。
|
||||
* 重新设计的新建虚拟机向导。
|
||||
|
||||
#### 通过命令行管理的全加密虚拟机
|
||||
|
||||
虚拟机(VM)现在可以完全加密了,但只能通过命令行界面。
|
||||
|
||||
这也包括加密的配置日志和暂存状态。
|
||||
|
||||
截至目前,用户只能通过命令行界面对机器进行加密,未来将增加不同的方式。
|
||||
|
||||
#### 新的资源监控工具
|
||||
|
||||
![VirtualBox 7.0 的资源监控][4]
|
||||
|
||||
新的实用程序可以让你监控性能统计,如 CPU、内存使用、磁盘 I/O 等。它将列出所有正在运行的客体的性能统计。
|
||||
|
||||
这不是最吸引人的补充,但很有用。
|
||||
|
||||
#### 改进的主题支持
|
||||
|
||||
对主题的支持在所有平台上都得到了改进。在 Linux 和 macOS 上使用原生引擎,而在 Windows 上,有一个单独的实现。
|
||||
|
||||
#### 对安全启动的支持
|
||||
|
||||
VirtualBox 现在支持安全启动,增强了对恶意软件、病毒和间谍软件的安全性。
|
||||
|
||||
它还将防止虚拟机使用损坏的驱动程序启动,这对企业应用非常重要。
|
||||
|
||||
使用那些需要安全启动才能运行的操作系统的用户现在应该能够轻松创建虚拟机了。
|
||||
|
||||
#### 其他变化
|
||||
|
||||
VirtualBox 7.0 是一次重大的升级。因此,有几个功能的增加和全面的完善。
|
||||
|
||||
例如,新件虚拟机向导现在已经重新设计,以整合无人值守的客体操作系统安装。
|
||||
|
||||
![virtualbox 7.0 无人值守的发行版安装][5]
|
||||
|
||||
其他改进包括:
|
||||
|
||||
* 云端虚拟机现在可以被添加到 VirtualBox,并作为本地虚拟机进行控制。
|
||||
* VirtualBox 的图标在此版本中得到了更新。
|
||||
* 引入了一个新的 3D 栈,支持 DirectX 11。它使用 [DXVK][6] 来为非 Windows 主机提供同样的支持。
|
||||
* 支持虚拟 TPM 1.2/2.0。
|
||||
* 改进了多显示器设置中的鼠标处理。
|
||||
* Vorbis 是音频录制的默认音频编解码器。
|
||||
|
||||
你可以查看 [发行说明][7] 以了解更多信息。
|
||||
|
||||
如果你正在寻找增强的功能,如更好的主题支持、加密功能、安全启动支持和类似的功能添加,VirtualBox 7.0 是一个不错的升级。
|
||||
|
||||
💬 *你对这次升级有什么看法?你会使用较新的版本还是暂时坚持使用旧版本的虚拟机?*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/virtualbox-7-0-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/w1200/2022/10/virtualbox-7-0-release.jpg
|
||||
[2]: https://www.oracle.com/in/
|
||||
[3]: https://news.itsfoss.com/content/images/2022/10/VirtualBox_7.0.png
|
||||
[4]: https://news.itsfoss.com/content/images/2022/10/VirtualBox_7.0_Resource_Monitor.png
|
||||
[5]: https://news.itsfoss.com/content/images/2022/10/VirtualBox_7.0_Unattended_Guest_Install.png
|
||||
[6]: https://github.com/doitsujin/dxvk
|
||||
[7]: https://www.virtualbox.org/wiki/Changelog-7.0
|
@ -0,0 +1,132 @@
|
||||
[#]: subject: "First Look at LURE! Bringing AUR to All Linux Distros"
|
||||
[#]: via: "https://news.itsfoss.com/lure-aur/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15151-1.html"
|
||||
|
||||
LURE 初窥!将 AUR 带入所有 Linux 发行版
|
||||
======
|
||||
|
||||
> LURE 是一个新的开源项目,它希望成为所有发行版的 AUR。
|
||||
|
||||
![LURE 是一个新的开源项目,它希望成为所有发行版的 AUR!][1]
|
||||
|
||||
AUR(<ruby>Arch 用户仓库<rt>Arch User Repository</rt></ruby>)是一个由社区驱动的基于 Arch 的 Linux 的发行版仓库。
|
||||
|
||||
**简而言之:** 它可以帮助你安装官方仓库中没有的软件包,并让你获得最新的版本。
|
||||
|
||||
我发现它对我在 [Manjaro Linux][2] 上的体验很有帮助。
|
||||
|
||||
从技术上讲,AUR 从源头构建一个软件包,然后利用软件包管理器(`pacman`)来安装它。
|
||||
|
||||
你也可以在我们的详细指南中探索更多关于它的信息。
|
||||
|
||||
> **[什么是 AUR? 如何在 Arch 和 Manjaro Linux 中使用 AUR?][3]**
|
||||
|
||||
📢 现在你对 AUR 有了一个基本的了解,有一个 **新的开源项目** 旨在将 AUR 的功能带到所有的发行版中。
|
||||
|
||||
这个项目被称为 “<ruby>Linux 用户仓库<rt>Linux User REpository</rt></ruby>”(LURE)。
|
||||
|
||||
> 💡 LURE 项目正处于 alpha 阶段,由创建者在几周前宣布。所以,它完全是一个正在进行的工作。
|
||||
|
||||
### 已经有这样的项目了?
|
||||
|
||||
![lure 添加仓库][5]
|
||||
|
||||
**没有。**
|
||||
|
||||
开发者们已经尝试做一个 AUR 的替代品,但是是针对特定的发行版。就像 [makedeb 软件包仓库][6] 是针对 Debian 的。
|
||||
|
||||
LURE 是一个雄心勃勃的想法,可以在你选择的任何发行版上工作。
|
||||
|
||||
它试图成为一个帮助你使用类似于 `PKGBUILD` 的脚本为你的发行版创建原生软件包的工具。
|
||||
|
||||
> **[创建 PKGBUILD 为 Arch Linux 制作软件包][7]**
|
||||
|
||||
开发者在 [Reddit 公告帖子][9] 中提到了一些技术细节:
|
||||
|
||||
> 我的项目叫 LURE,是 “Linux 用户仓库”的简称。它构建原生软件包,然后使用系统软件包管理器安装它们,就像 AUR 一样。它使用一个类似于 AUR 的 `PKGBUILD` 的构建脚本来构建软件包。
|
||||
>
|
||||
> 它是用纯 Go 语言编写的,这意味着它在构建后没有任何依赖性,除了一些特权提升命令(`sudo`,`doas` 等等)和任何一个支持的软件包管理器,目前支持 `pacman`、`apt`、`apk`(Alpine Linux 上,不是安卓)、`dnf`、`yum` 和 `zypper`。
|
||||
|
||||
**听起来很棒!**
|
||||
|
||||
> **[LURE 项目Repo][10]**
|
||||
|
||||
你也可以在它的 [GitHub 镜像][11] 上探索更多信息。
|
||||
|
||||
### 使用 LURE
|
||||
|
||||
你不必安装一个额外的软件包管理器来使它工作,它可以自动与你系统的软件包管理器一起工作。
|
||||
|
||||
因此,如果它在其仓库(或任何其添加的仓库)中没有找到一个包,它就会转到系统的默认仓库,并从那里安装它。就像我用 `lure` 命令在我的系统上安装/移除 `neofetch` 一样。
|
||||
|
||||
![lure neofetch remove][12]
|
||||
|
||||
虽然该项目处于早期开发阶段,但它为各种发行版提供了 [二进制包][13],以让你安装和测试它们。
|
||||
|
||||
![][14]
|
||||
|
||||
目前,它的仓库包括一个来自创建者自己的项目。但你可以尝试添加一个仓库并构建/安装东西。
|
||||
|
||||
为了方便起见,我试着在它的仓库中安装软件包。
|
||||
|
||||
![][15]
|
||||
|
||||
命令看起来像这样:
|
||||
|
||||
```
|
||||
lure in itd-bin
|
||||
```
|
||||
|
||||
在它的 [官方文档页面][16],你可以读到更多关于它在构建/安装/添加存储库方面的用法。
|
||||
|
||||
未来版本的一些计划中的功能包括:
|
||||
|
||||
* 自动安装脚本
|
||||
* 基于 Docker 的自动测试工具
|
||||
* 仓库的网页接口
|
||||
|
||||
### 让它变得更好
|
||||
|
||||
嗯,首先,这是一个优秀的项目。如果你是过去使用过 Arch 的人,或者想离开 Arch Linux,这将是一个很好的工具。
|
||||
|
||||
然而,对于大多数终端用户和非 Arch Linux 新手来说,像 [Pamac GUI 软件包管理器][17] 这样的软件包管理器支持 LURE 应该是锦上添花的。
|
||||
|
||||
当然,在目前的阶段,它需要开源贡献者的支持。所以,如果你喜欢这个想法,请随时为该项目贡献改进意见
|
||||
|
||||
*💭 你对 LURE 有什么看法?请在下面的评论中分享你的想法! *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/lure-aur/
|
||||
|
||||
作者:[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/w1200/2022/10/LURE-aur-for-all-linux-distros.jpg
|
||||
[2]: https://news.itsfoss.com/manjaro-linux-experience/
|
||||
[3]: https://itsfoss.com/aur-arch-linux/
|
||||
[4]: https://itsfoss.com/aur-arch-linux/
|
||||
[5]: https://news.itsfoss.com/content/images/2022/10/lure-repos.png
|
||||
[6]: https://mpr.makedeb.org
|
||||
[7]: https://itsfoss.com/create-pkgbuild/
|
||||
[8]: https://itsfoss.com/create-pkgbuild/
|
||||
[9]: https://www.reddit.com/r/linux/comments/xq09nf/lure_aur_on_nonarch_distros/
|
||||
[10]: https://gitea.arsenm.dev/Arsen6331/lure
|
||||
[11]: https://github.com/Arsen6331/lure
|
||||
[12]: https://news.itsfoss.com/content/images/2022/10/lure-neofetch-rm.png
|
||||
[13]: https://gitea.arsenm.dev/Arsen6331/lure/releases/tag/v0.0.2
|
||||
[14]: https://news.itsfoss.com/content/images/2022/10/lure-binaries.jpg
|
||||
[15]: https://news.itsfoss.com/content/images/2022/10/lure-test.png
|
||||
[16]: https://github.com/Arsen6331/lure/blob/master/docs/usage.md
|
||||
[17]: https://itsfoss.com/install-pamac-arch-linux/
|
@ -0,0 +1,109 @@
|
||||
[#]: subject: "Notion-like Markdown Note-Taking App 'Obsidian' is Out of Beta"
|
||||
[#]: via: "https://news.itsfoss.com/obsidian-1-release/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15147-1.html"
|
||||
|
||||
类似 Notion 的 Markdown 笔记应用黑曜石推出测试版
|
||||
======
|
||||
|
||||
> 黑曜石 1.0 做了重新设计,带来了有价值的新功能。
|
||||
|
||||
![类似于 Notion 的 Markdown 笔记软件 Obsidian 推出了测试版][1]
|
||||
|
||||
<ruby>黑曜石<rt>Obsidian</rt></ruby> 是一款强大的笔记应用,可以用来制作知识图谱,同时还提供 [Notion][2] 类似的功能。
|
||||
|
||||
在 1.0 更新之前,我们已经有一篇关于它的 [详细文章][3]。
|
||||
|
||||
黑曜石 1.0 的发布标志着该应用在桌面和移动体验方面的发展迈出了关键一步。
|
||||
|
||||
> 💡 黑曜石不是一个开源的应用程序,但可以在 Linux 上使用。
|
||||
|
||||
让我们来看看它的桌面版提供的新功能。
|
||||
|
||||
### 🆕 黑曜石 1.0 的新功能
|
||||
|
||||
![黑曜石 1.0][5]
|
||||
|
||||
1.0 版本增加了大量的新功能、主要的视觉变化和错误修复,其中一些亮点包括:
|
||||
|
||||
* 改良的用户界面
|
||||
* 新的外观设置
|
||||
* 带有标签堆叠的标签功能
|
||||
* 大修的主题画廊
|
||||
* 各种错误的修复
|
||||
|
||||
#### 🎨 用户界面的改造
|
||||
|
||||
![黑曜石 1.0 用户界面][8]
|
||||
|
||||
用户界面已经得到了全面改造,这使得用户体验更加直观和强大。
|
||||
|
||||
![黑曜石用户界面][9]
|
||||
|
||||
除此之外,黑曜石现在还有一个专门的外观设置部分。它包含了切换显示内联标题、标签标题栏、改变重点颜色等选项的设置。
|
||||
|
||||
![黑曜石 1.0 外观设置][10]
|
||||
|
||||
#### 带有标签堆叠的标签功能
|
||||
|
||||
![黑曜石 1.0 的标签][11]
|
||||
|
||||
现在你可以在黑曜石中打开多个标签,并使用热键来帮助你在忙碌的一天中完成多个任务。
|
||||
|
||||
一个额外的好处是,即使你退出黑曜石,它也会记住你曾经打开的标签和你在这些标签中的活动状态。
|
||||
|
||||
![黑曜石 1.0 的标签堆叠][12]
|
||||
|
||||
标签也可以分组形成堆叠,并在它们之间进行切换,从而使工作空间变得更加整齐。
|
||||
|
||||
#### 🛠️ 其他变化
|
||||
|
||||
其他值得一提的变化包括:
|
||||
|
||||
* 改变缩放级别的能力
|
||||
* 改进了黑曜石的同步
|
||||
* 内存泄漏修复
|
||||
* 用于折叠行的折叠命令
|
||||
|
||||
你可以通过 [发布说明][13],以及 [发布公告][14] 来了解更多的细节。
|
||||
|
||||
### 📥 下载黑曜石 1.0
|
||||
|
||||
你可以到 [官方网站][17] 下载黑曜石 1.0。在手机上,也可以在谷歌应用商店和苹果的应用商店上找到它。
|
||||
|
||||
为 Linux 用户提供了三个软件包:**AppImage、Flatpak 和 Snap**。
|
||||
|
||||
开发者还澄清说,他们不会向个人用户收取黑曜石的使用费。
|
||||
|
||||
*💬 你对黑曜石 1.0 有什么看法?一个值得替代其他记事本的应用程序吗?*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/obsidian-1-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/w1200/2022/10/obsidian-1.png
|
||||
[2]: https://notion.grsm.io/itsfoss
|
||||
[3]: https://linux.cn/article-14230-1.html
|
||||
[5]: https://news.itsfoss.com/content/images/2022/10/Obsidian_1.0.png
|
||||
[8]: https://news.itsfoss.com/content/images/2022/10/Obsidian_1.0_User_Interface.png
|
||||
[9]: https://news.itsfoss.com/content/images/2022/10/obisidian-1-ui.png
|
||||
[10]: https://news.itsfoss.com/content/images/2022/10/Obsidian_1.0_Appearance_Settings.png
|
||||
[11]: https://news.itsfoss.com/content/images/2022/10/Obsidian_1.0_Tabs.png
|
||||
[12]: https://news.itsfoss.com/content/images/2022/10/Obsidian_1.0_Tab_Stacks.gif
|
||||
[13]: https://forum.obsidian.md/t/obsidian-release-v1-0-0/44873
|
||||
[14]: https://obsidian.md/1.0
|
||||
[17]: https://obsidian.md/download
|
||||
[18]: https://www.youtube-nocookie.com/embed/Ia2CaItxTEk
|
@ -0,0 +1,77 @@
|
||||
[#]: subject: "Blender 3.4 to Enable Native Wayland Support for Linux"
|
||||
[#]: via: "https://news.itsfoss.com/blender-3-4-release/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Blender 3.4 to Enable Native Wayland Support for Linux
|
||||
======
|
||||
Blender is bringing in native Wayland support soon. Learn more here.
|
||||
|
||||
![Blender 3.4 to Enable Native Wayland Support for Linux][1]
|
||||
|
||||
Blender is a popular 3D creation suite that many professionals use.
|
||||
|
||||
The developers of Blender have recently added native Wayland support for Linux in the daily builds, and have confirmed adding the support in the upcoming Blender 3.4 release.
|
||||
|
||||
This is probably one of the significant development progress after [Blender 3.0 release][2] last year!
|
||||
|
||||
### Blender With Native Wayland
|
||||
|
||||
[Wayland][3] is a replacement to the X11 [display server][4] that aims to be a simpler and more modern solution.
|
||||
|
||||
Providing native Wayland support has become necessary, mainly because many distros now come with that kind of support out of the box.
|
||||
|
||||
With more Wayland support in the works and users switching to a distro with native support, this move was a given.
|
||||
|
||||
[Linux Laptops - Powered by Open Source][5]
|
||||
|
||||
With the daily builds, the **libdecor** library has made this possible. If you want to test it out, you need to have it installed for Blender to work correctly with native Wayland support.
|
||||
|
||||
While initial support for Wayland was present in Blender since 2020, it was not ready for prime time. It had a lot of issues, such as no tablet support, no NDOF support, no Hi-DPI support, and similar.
|
||||
|
||||
Now, it looks like most of those issues are gone.
|
||||
|
||||
### Expect it With Blender 3.4
|
||||
|
||||
A blog post by one of Blender's developers *Campbell Barton,* reveals that if all goes well with the daily builds, the Wayland support is coming to Blender 3.4.
|
||||
|
||||
Here's what he mentions:
|
||||
|
||||
> Now Wayland is enabled in our official builds, I hope to validate it for the up coming release. So unless issues arise which we’re unable to resolve, it will be officially supported in Blender 3.4x onward.
|
||||
|
||||
At this point, I can only hope that no significant issues affect its integration.
|
||||
|
||||
Otherwise, it may push back to a later release cycle.
|
||||
|
||||
Blender 3.4 will release in early **December 2022**, with improvements across the board and new features such as headless rendering for Linux, improvements for Sculpt, Intel Open PGL integration, and more.
|
||||
|
||||
> 💡 Blender with Wayland has some technical limitations. You can find more details on that in the [blog post][9].
|
||||
|
||||
💬*Are you excited to try out native Wayland support on Blender?*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/blender-3-4-release/
|
||||
|
||||
作者:[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/w1200/2022/10/blender-3-4-release.png
|
||||
[2]: https://news.itsfoss.com/blender-3-0-release/
|
||||
[3]: https://wayland.freedesktop.org/
|
||||
[4]: https://itsfoss.com/display-server/
|
||||
[5]: https://starlabs.systems/?rfsn=4790429.bdbc07
|
||||
[6]: https://starlabs.systems/?rfsn=4790429.bdbc07
|
||||
[7]: https://itsfoss.com/open-source-video-editors/
|
||||
[8]: https://itsfoss.com/open-source-video-editors/
|
||||
[9]: https://code.blender.org/2022/10/wayland-support-on-linux/
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://opensource.com/open-organization/22/6/using-habits-practice-open-organization-principles"
|
||||
[#]: author: "Ron McFarland https://opensource.com/users/ron-mcfarland"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "Donkey-Hao"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
@ -131,7 +131,7 @@ via: https://opensource.com/open-organization/22/6/using-habits-practice-open-or
|
||||
|
||||
作者:[Ron McFarland][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[Donkey-Hao](https://github.com/Donkey-Hao)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,184 +0,0 @@
|
||||
[#]: subject: "7 summer book recommendations from open source enthusiasts"
|
||||
[#]: via: "https://opensource.com/article/22/6/2022-opensourcecom-summer-reading-list"
|
||||
[#]: author: "Joshua Allen Holm https://opensource.com/users/holmja"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
7 summer book recommendations from open source enthusiasts
|
||||
======
|
||||
Members of the Opensource.com community recommend this mix of books covering everything from a fun cozy mystery to non-fiction works that explore thought-provoking topics.
|
||||
|
||||
![Ceramic mug of tea or coffee with flowers and a book in front of a window][1]
|
||||
|
||||
Image by: Photo by [Carolyn V][2] on [Unsplash][3]
|
||||
|
||||
It is my great pleasure to introduce Opensource.com's 2022 summer reading list. This year's list contains seven wonderful reading recommendations from members of the Opensource.com community. You will find a nice mix of books covering everything from a fun cozy mystery to non-fiction works that explore thought-provoking topics. I hope you find something on this list that interests you.
|
||||
|
||||
Enjoy!
|
||||
|
||||
![Book title 97 Things Every Java Programmer Should Know][4]
|
||||
|
||||
Image by: O'Reilly Press
|
||||
|
||||
**[97 Things Every Java Programmer Should Know: Collective Wisdom from the Experts, edited by Kevlin Henney and Trisha Gee][5]**
|
||||
|
||||
*[Recommendation written by Seth Kenlon][6]*
|
||||
|
||||
Written by 73 different authors working in all aspects of the software industry, the secret to this book's greatness is that it actually applies to much more than just Java programming. Of course, some chapters lean into Java, but there are topics like Be aware of your container surroundings, Deliver better software, faster, and Don't hIDE your tools that apply to development regardless of language.
|
||||
|
||||
Better still, some chapters apply to life in general. Break problems and tasks into small chunks is good advice on how to tackle any problem, Build diverse teams is important for every group of collaborators, and From puzzles to products is a fascinating look at how the mind of a puzzle-solver can apply to many different job roles.
|
||||
|
||||
Each chapter is just a few pages, and with 97 to choose from, it's easy to skip over the ones that don't apply to you. Whether you write Java code all day, just dabble, or if you haven't yet started, this is a great book for geeks interested in code and the process of software development.
|
||||
|
||||
![Book title A City is Not a Computer][7]
|
||||
|
||||
Image by: Princeton University Press
|
||||
|
||||
**[A City is Not a Computer: Other Urban Intelligences, by Shannon Mattern][8]**
|
||||
|
||||
*[Recommendation written by Scott Nesbitt][9]*
|
||||
|
||||
These days, it's become fashionable (if not inevitable) to make everything *smart*: Our phones, our household appliances, our watches, our cars, and, especially, our cities.
|
||||
|
||||
With the latter, that means putting sensors everywhere, collecting data as we go about our business, and pushing information (whether useful or not) to us based on that data.
|
||||
|
||||
This begs the question, does embedding all that technology in a city make it smart? In *A City Is Not a Computer*, Shannon Mattern argues that it doesn't.
|
||||
|
||||
A goal of making cities smart is to provide better engagement with and services to citizens. Mattern points out that smart cities often "aim to merge the ideologies of technocratic managerialism and public service, to reprogram citizens as 'consumers' and 'users'." That, instead of encouraging citizens to be active participants in their cities' wider life and governance.
|
||||
|
||||
Then there's the data that smart systems collect. We don't know what and how much is being gathered. We don't know how it's being used and by whom. There's *so much* data being collected that it overwhelms the municipal workers who deal with it. They can't process it all, so they focus on low-hanging fruit while ignoring deeper and more pressing problems. That definitely wasn't what cities were promised when they were sold smart systems as a balm for their urban woes.
|
||||
|
||||
*A City Is Not a Computer* is a short, dense, well-researched polemic against embracing smart cities because technologists believe we should. The book makes us think about the purpose of a smart city, who really benefits from making a city smart, and makes us question whether we need to or even should do that.
|
||||
|
||||
![Book title git sync murder][10]
|
||||
|
||||
Image by: Tilted Windmill Press
|
||||
|
||||
**[git sync murder, by Michael Warren Lucas][11]**
|
||||
|
||||
*[Recommendation written by Joshua Allen Holm][12]*
|
||||
|
||||
Dale Whitehead would rather stay at home and connect to the world through his computer's terminal, especially after what happened at the last conference he attended. During that conference, Dale found himself in the role of an amateur detective solving a murder. You can read about that case in the first book in this series, *git commit murder*.
|
||||
|
||||
Now, back home and attending another conference, Dale again finds himself in the role of detective. *git sync murder* finds Dale attending a local tech conference/sci-fi convention where a dead body is found. Was it murder or just an accident? Dale, now the "expert" on these matters, finds himself dragged into the situation and takes it upon himself to figure out what happened. To say much more than that would spoil things, so I will just say *git sync murder* is engaging and enjoyable to read. Reading *git commit murder* first is not necessary to enjoy *git sync murder*, but I highly recommend both books in the series.
|
||||
|
||||
Michael Warren Lucas's *git murder* series is perfect for techies who also love cozy mysteries. Lucas has literally written the book on many complex technical topics, and it carries over to his fiction writing. The characters in *git sync murder* talk tech at conference booths and conference social events. If you have not been to a conference recently because of COVID and miss the experience, Lucas will transport you to a tech conference with the added twist of a murder mystery to solve. Dale Whitehead is an interesting, if somewhat unorthodox, cozy mystery protagonist, and I think most Opensource.com readers would enjoy attending a tech conference with him as he finds himself thrust into the role of amateur sleuth.
|
||||
|
||||
![Book title Kick Like a Girl][13]
|
||||
|
||||
Image by: Inner Wings Foundation
|
||||
|
||||
**[Kick Like a Girl, by Melissa Di Donato Roos][14]**
|
||||
|
||||
*[Recommendation written by Joshua Allen Holm][15]*
|
||||
|
||||
Nobody likes to be excluded, but that is what happens to Francesca when she wants to play football at the local park. The boys won't play with her because she's a girl, so she goes home upset. Her mother consoles her by relating stories about various famous women who have made an impact in some significant way. The historical figures detailed in *Kick Like a Girl* include women from throughout history and from many different fields. Readers will learn about Frida Kahlo, Madeleine Albright, Ada Lovelace, Rosa Parks, Amelia Earhart, Marie Curie, Valentina Tereshkova, Florence Nightingale, and Malala Yousafzai. After hearing the stories of these inspiring figures, Francesca goes back to the park and challenges the boys to a football match.
|
||||
|
||||
*Kick Like a Girl* features engaging writing by Melissa Di Donato Roos (SUSE's CEO) and excellent illustrations by Ange Allen. This book is perfect for young readers, who will enjoy the rhyming text and colorful illustrations. Di Donato Roos has also written two other books for children, *How Do Mermaids Poo?* and *The Magic Box*, both of which are also worth checking out.
|
||||
|
||||
![Book title Mine!][16]
|
||||
|
||||
Image by: Doubleday
|
||||
|
||||
**[Mine!: How the Hidden Rules of Ownership Control Our Lives, by Michael Heller and James Salzman][17]**
|
||||
|
||||
*[Recommendation written by Bryan Behrenshausen][18]*
|
||||
|
||||
"A lot of what you know about ownership is wrong," authors Michael Heller and James Salzman write in *Mine!* It's the kind of confrontational invitation people drawn to open source can't help but accept. And this book is certainly one for open source aficionados, whose views on ownership—of code, of ideas, of intellectual property of all kinds—tend to differ from mainstream opinions and received wisdom. In this book, Heller and Salzman lay out the "hidden rules of ownership" that govern who controls access to what. These rules are subtle, powerful, deeply historical conventions that have become so commonplace they just seem incontrovertible. We know this because they've become platitudes: "First come, first served" or "You reap what you sow." Yet we see them play out everywhere: On airplanes in fights over precious legroom, in the streets as neighbors scuffle over freshly shoveled parking spaces, and in courts as juries decide who controls your inheritance and your DNA. Could alternate theories of ownership create space for rethinking some essential rights in the digital age? The authors certainly think so. And if they're correct, we might respond: Can open source software serve as a model for how ownership works—or doesn't—in the future?
|
||||
|
||||
![Book Title Not All Fairy Tales Have Happy Endings][19]
|
||||
|
||||
Image by: Lulu.com
|
||||
|
||||
**[Not All Fairy Tales Have Happy Endings: The Rise and Fall of Sierra On-Line, by Ken Williams][20]**
|
||||
|
||||
*[Recommendation written by Joshua Allen Holm][21]*
|
||||
|
||||
During the 1980s and 1990s, Sierra On-Line was a juggernaut in the computer software industry. From humble beginnings, this company, founded by Ken and Roberta Williams, published many iconic computer games. King's Quest, Space Quest, Quest for Glory, Leisure Suit Larry, and Gabriel Knight are just a few of the company's biggest franchises.
|
||||
|
||||
*Not All Fairy Tales Have Happy Endings* covers everything from the creation of Sierra's first game, [Mystery House][22], to the company's unfortunate and disastrous acquisition by CUC International and the aftermath. The Sierra brand would live on for a while after the acquisition, but the Sierra founded by the Williams was no more. Ken Williams recounts the entire history of Sierra in a way that only he could. His chronological narrative is interspersed with chapters providing advice about management and computer programming. Ken Williams had been out of the industry for many years by the time he wrote this book, but his advice is still extremely relevant.
|
||||
|
||||
Sierra On-Line is no more, but the company made a lasting impact on the computer gaming industry. *Not All Fairy Tales Have Happy Endings* is a worthwhile read for anyone interested in the history of computer software. Sierra On-Line was at the forefront of game development during its heyday, and there are many valuable lessons to learn from the man who led the company during those exciting times.
|
||||
|
||||
![Book title The Soul of a New Machine][23]
|
||||
|
||||
Image by: Back Bay Books
|
||||
|
||||
**[The Soul of a New Machine, by Tracy Kidder][24]**
|
||||
|
||||
*[Recommendation written by Guarav Kamathe][25]*
|
||||
|
||||
I am an avid reader of the history of computing. It's fascinating to know how these intelligent machines that we have become so dependent on (and often take for granted) came into being. I first heard of [The Soul of a New Machine][26] via [Bryan Cantrill][27]'s [blog post][28]. This is a non-fiction book written by [Tracy Kidder][29] and published in 1981 for which he [won a Pulitzer prize][30]. Imagine it's the 1970s, and you are part of the engineering team tasked with designing the [next generation computer][31]. The backdrop of the story begins at Data General Corporation, a then mini-computer vendor who was racing against time to compete with the 32-bit VAX computers from Digital Equipment Corporation (DEC). The book outlines how two competing teams within Data General, both wanting to take a shot at designing the new machine, results in a feud. What follows is a fascinating look at the events that unfold. The book provides insights into the minds of the engineers involved, the management, their work environment, the technical challenges they faced along the way and how they overcame them, how stress affected their personal lives, and much more. Anybody who wants to know what goes into making a computer should read this book.
|
||||
|
||||
There is the 2022 suggested reading list. It provides a variety of great options that I believe will provide Opensource.com readers with many hours of thought-provoking entertainment. Be sure to check out our previous reading lists for even more book recommendations.
|
||||
|
||||
* [2021 Opensource.com summer reading list][32]
|
||||
* [2020 Opensource.com summer reading list][33]
|
||||
* [2019 Opensource.com summer reading list][34]
|
||||
* [2018 Open Organization summer reading list][35]
|
||||
* [2016 Opensource.com summer reading list][36]
|
||||
* [2015 Opensource.com summer reading list][37]
|
||||
* [2014 Opensource.com summer reading list][38]
|
||||
* [2013 Opensource.com summer reading list][39]
|
||||
* [2012 Opensource.com summer reading list][40]
|
||||
* [2011 Opensource.com summer reading list][41]
|
||||
* [2010 Opensource.com summer reading list][42]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/2022-opensourcecom-summer-reading-list
|
||||
|
||||
作者:[Joshua Allen Holm][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/holmja
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/tea-cup-mug-flowers-book-window.jpg
|
||||
[2]: https://unsplash.com/@sixteenmilesout?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/tea?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://opensource.com/sites/default/files/2022-06/97_Things_Every_Java_Programmer_Should_Know_1.jpg
|
||||
[5]: https://www.oreilly.com/library/view/97-things-every/9781491952689/
|
||||
[6]: https://opensource.com/users/seth
|
||||
[7]: https://opensource.com/sites/default/files/2022-06/A_City_is_Not_a_Computer_0.jpg
|
||||
[8]: https://press.princeton.edu/books/paperback/9780691208053/a-city-is-not-a-computer
|
||||
[9]: https://opensource.com/users/scottnesbitt
|
||||
[10]: https://opensource.com/sites/default/files/2022-06/git_sync_murder_0.jpg
|
||||
[11]: https://mwl.io/fiction/crime#gsm
|
||||
[12]: https://opensource.com/users/holmja
|
||||
[13]: https://opensource.com/sites/default/files/2022-06/Kick_Like_a_Girl.jpg
|
||||
[14]: https://innerwings.org/books/kick-like-a-girl
|
||||
[15]: https://opensource.com/users/holmja
|
||||
[16]: https://opensource.com/sites/default/files/2022-06/Mine.jpg
|
||||
[17]: https://www.minethebook.com/
|
||||
[18]: https://opensource.com/users/bbehrens
|
||||
[19]: https://opensource.com/sites/default/files/2022-06/Not_All_Fairy_Tales.jpg
|
||||
[20]: https://kensbook.com/
|
||||
[21]: https://opensource.com/users/holmja
|
||||
[22]: https://en.wikipedia.org/wiki/Mystery_House
|
||||
[23]: https://opensource.com/sites/default/files/2022-06/The_Soul_of_a_New_Machine.jpg
|
||||
[24]: https://www.hachettebookgroup.com/titles/tracy-kidder/the-soul-of-a-new-machine/9780316204552/
|
||||
[25]: https://opensource.com/users/gkamathe
|
||||
[26]: https://en.wikipedia.org/wiki/The_Soul_of_a_New_Machine
|
||||
[27]: https://en.wikipedia.org/wiki/Bryan_Cantrill
|
||||
[28]: http://dtrace.org/blogs/bmc/2019/02/10/reflecting-on-the-soul-of-a-new-machine/
|
||||
[29]: https://en.wikipedia.org/wiki/Tracy_Kidder
|
||||
[30]: https://www.pulitzer.org/winners/tracy-kidder
|
||||
[31]: https://en.wikipedia.org/wiki/Data_General_Eclipse_MV/8000
|
||||
[32]: https://opensource.com/article/21/6/2021-opensourcecom-summer-reading-list
|
||||
[33]: https://opensource.com/article/20/6/summer-reading-list
|
||||
[34]: https://opensource.com/article/19/6/summer-reading-list
|
||||
[35]: https://opensource.com/open-organization/18/6/summer-reading-2018
|
||||
[36]: https://opensource.com/life/16/6/2016-summer-reading-list
|
||||
[37]: https://opensource.com/life/15/6/2015-summer-reading-list
|
||||
[38]: https://opensource.com/life/14/6/annual-reading-list-2014
|
||||
[39]: https://opensource.com/life/13/6/summer-reading-list-2013
|
||||
[40]: https://opensource.com/life/12/7/your-2012-open-source-summer-reading
|
||||
[41]: https://opensource.com/life/11/7/summer-reading-list
|
||||
[42]: https://opensource.com/life/10/8/open-books-opensourcecom-summer-reading-list
|
@ -1,253 +0,0 @@
|
||||
[#]: subject: "Advantages and Disadvantages of Using Linux"
|
||||
[#]: via: "https://itsfoss.com/advantages-linux/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Advantages and Disadvantages of Using Linux
|
||||
======
|
||||
Linux is a buzzword and you keep hearing about Linux here and there. People discuss it in the tech forum, it is part of the course curriculum and your favorite tech YouTubers get excited while showing their Linux build. The 10x developers you follow on Twitter are all Linux fans.
|
||||
|
||||
Basically, Linux is everywhere and everyone keeps talking about it. And that gives you FOMO.
|
||||
|
||||
So, you wonder about the advantages of Linux and whether is it really worth trying.
|
||||
|
||||
I have compiled various possible advantages and disadvantages of Linux in this article.
|
||||
|
||||
If you are on the fence about choosing Linux over your preferred operating system, we would like to help you out.
|
||||
|
||||
Before you start, you should know that Linux is not an operating system on its own. The operating systems are called [Linux distributions and there are hundreds of them][1]. For simplicity, I’ll address it as Linux OS instead of a specific Linux distribution. This [article][2] explains things better.
|
||||
|
||||
### Advantages of Using Linux
|
||||
|
||||
Considering you are curious about Linux as an alternative operating system choice, it only makes sense that you know its advantages.
|
||||
|
||||
You might never regret your decision if it excels at what you want it to do.
|
||||
|
||||
#### No Need to Purchase a License
|
||||
|
||||
![open source proprietary illustration][3]
|
||||
|
||||
You need to own an Apple device to use macOS as your daily driver and a Windows license to use Microsoft’s Windows.
|
||||
|
||||
Therefore, you need a bit of investment with these options. But, with Linux? It’s entirely free.
|
||||
|
||||
Not just the OS, there are many software packages available for free on Linux when compared to Windows and macOS.
|
||||
|
||||
You can try every mainstream Linux distribution without paying for a license. Of course, you get the option to donate to support the project, but that is up to you if you really like it.
|
||||
|
||||
**Additionally**, Linux is totally open-source, meaning anyone can inspect the source code for transparency.
|
||||
|
||||
#### Can Run With Minimal System Resources
|
||||
|
||||
![linux mint 21 resource usage][4]
|
||||
|
||||
Typically, when users think of trying another operating system, it is because they are frustrated with the performance of their system.
|
||||
|
||||
This is from my personal experience. I have had friends willing to try Linux to revive their old laptop or a system that constantly lags.
|
||||
|
||||
And, when it comes to Linux distributions, they are capable of running on decent hardware configurations. You do not need to have the latest and greatest. Moreover, there are specialized [lightweight Linux distributions][5] that are tailored to run on older hardware with no hiccups.
|
||||
|
||||
So, you have more chances to revive your old system or get a fast-performing computer in no time with Linux.
|
||||
|
||||
#### Less Exposed to Malware
|
||||
|
||||
![malware illustration][6]
|
||||
|
||||
No operating system is safe from malicious files or scripts. If you download and run something from an unknown source, you cannot guarantee its safety.
|
||||
|
||||
However, things are better for Linux. Yes, researchers have found attackers targeting Linux IoT devices. But, for desktop Linux, it is not “yet” something to worry about.
|
||||
|
||||
Malicious actors target platforms that are more popular among households, and Linux does not have a big market share in the desktop space to attract that kind of attention. In a way, it can be a good thing.
|
||||
|
||||
All you have to do is just stick to the official software packages, and read instructions before you do anything.
|
||||
|
||||
As an extra plus, you do not necessarily need an antivirus program to get protection from malware.
|
||||
|
||||
#### Customization
|
||||
|
||||
![Pop!_OS 22.04 LTS][7]
|
||||
|
||||
With an open-source code, you get the freedom to customize your Linux experience as much as you want.
|
||||
|
||||
Of course, you require a bit of technical expertise to go utilize the best of it. Even without any experience, you get more customization features in your operating system when compared to macOS and Windows.
|
||||
|
||||
![Customized Linux experience | Reddit user: u/ZB652][8]
|
||||
|
||||
[u/ZB652][9]
|
||||
|
||||
If you are into personalizing your experience and willing to put in extra effort, Linux is for you. As an example, refer to the [KDE customization guide][10] and [dock options][11] to get basic ideas.
|
||||
|
||||
#### Something for Everyone
|
||||
|
||||
With macOS or Windows, you get limited to the design/preference choices finalized by Microsoft or Apple.
|
||||
|
||||
But, with Linux, you will find several Linux distributions that try to focus on various things.
|
||||
|
||||
For instance, you can opt for a Linux distribution that focuses on getting the latest features all the time, or you can opt for something that only gives you security/maintenance updates.
|
||||
|
||||
You can get something that looks beautiful out of the box or something that you provide crazy customization options. You will not run out of options with Linux.
|
||||
|
||||
I recommend starting with [options that give you the best user experience][12].
|
||||
|
||||
#### Complete Development Environment
|
||||
|
||||
If you are a software developer or student learning to code, Linux definitely has an edge. A lot of your build tools are available and integrated into Linux. With Docker, you can create specialized test environment easily.
|
||||
|
||||
Microsoft knows about this part and this is why it created WSL to give developers access to Linux environments inside Windows. Still, WSL doesn’t come close to the real Linux experience. The same goes for using Docker on Windows.
|
||||
|
||||
I know the same cannot be said about web designing because the coveted Adobe tools are not available on Linux yet. But if you don’t need Adobe for your work, Linux is a pretty good choice.
|
||||
|
||||
#### Learning Linux is a Skill One Must Have!
|
||||
|
||||
There is a learning curve to using Linux, but it provides you with insights on various things.
|
||||
|
||||
You get to learn how things work in an operating system by exploring and customizing it, or even just by using it.
|
||||
|
||||
Not everyone knows how to use Linux.
|
||||
|
||||
So, it can be a great skill to gain and expand your knowledge of software and computers.
|
||||
|
||||
#### Linux is an in-demand Job Skill
|
||||
|
||||
![job illustration][13]
|
||||
|
||||
As I mentioned above, it is a great skill to have. But, not just limited to expanding your knowledge, it is also useful professionally.
|
||||
|
||||
You can work your way to become a Linux system administrator or a security expert and fill several other job roles by learning the fundamentals of Linux.
|
||||
|
||||
So, learning Linux opens up a whole range of opportunities!
|
||||
|
||||
#### Privacy-Friendly
|
||||
|
||||
These days you cannot use Windows without a Microsoft account. And when you set up Windows, you’ll find that it tries to track your data from a number of services and applications.
|
||||
|
||||
![privacy windows][14]
|
||||
|
||||
While you can find such settings and disable them, it is clear that Windows is configured to disregard your privacy by default.
|
||||
|
||||
That’s not the case in Linux. While some applications/distributions may have an optional feature to let you share useful insights with them, it has never been a big deal. Most of the things on Linux are tailored to give you maximum privacy by default without needing to configure anything.
|
||||
|
||||
Apple and Microsoft on the other hand have clever tactics to collect anonymous usage data from your computer. Occasionally, they log your activity on their app store and while you are signed in through your account.
|
||||
|
||||
#### DIY projects and Self-hosting
|
||||
|
||||
Got a tinkerer in you? If you like to make electronics or software projects, Linux is your paradise.
|
||||
|
||||
You can use Linux on [single-board computers like Raspberry Pi][15] and create cool things like retro gaming consoles, home automation systems, etc.
|
||||
|
||||
You can also deploy open source software on your own server and maintain them. This is called self-hosting and it has the following advantages:
|
||||
|
||||
* Reduce hosting costs
|
||||
* Take control of your data
|
||||
* Customize the app/service as per your requirements
|
||||
|
||||
Clearly, you’ll be doing all this either directly with Linux or tools built on top of it.
|
||||
|
||||
### Disadvantages of Linux
|
||||
|
||||
Linux is not a flawless choice. Just like everything, there are some downsides to Linux as well. Those include:
|
||||
|
||||
#### Learning Curve
|
||||
|
||||
![too much learn illustration][16]
|
||||
|
||||
Every so often it is not just about learning a new skill, it is more about getting comfortable as quickly as possible.
|
||||
|
||||
If a user cannot get their way around the task they intend to do, it is not for them. It is true for every operating system. For instance, a user who uses Windows/macOS, may not get comfortable with Linux as quickly.
|
||||
|
||||
You can read our comparison article to know the [difference between macOS and Linux][17].
|
||||
|
||||
I agree that some users catch on quicker than others. But, in general, when you step into the Linux world, you need to be willing to put a bit of effort into learning the things that are not obvious.
|
||||
|
||||
#### Variety
|
||||
|
||||
While we recommend using the [best Linux distributions tailored for beginners][18], choosing what you like at first can be overwhelming.
|
||||
|
||||
You might want to try multiple of them to see what works with you best, which can be time-consuming and confusing.
|
||||
|
||||
It’s best to settle with one of the Linux distributions. But, if you remain confused, you can stick to Windows/macOS.
|
||||
|
||||
#### Market Share in Desktop Space
|
||||
|
||||
![linux desktop market share][19]
|
||||
|
||||
Linux is not a popular desktop operating system.
|
||||
|
||||
This should not be of concern to a user. However, without having a significant market presence, you cannot expect app developers to make/maintain tools for Linux.
|
||||
|
||||
Sure, there are lots of essential and popular tools available for Linux, more than ever. But, it remains a factor that may mean that not all good tools/services work on Linux.
|
||||
|
||||
Refer to our regularly updated article on [Linux’s market share][20], to get an idea.
|
||||
|
||||
#### Lack of Proprietary Software
|
||||
|
||||
As I mentioned above, not everyone is interested in bringing their tools/apps to Linux.
|
||||
|
||||
Hence, you may not find all the good proprietary offerings for Windows/macOS. Sure, you can use a compatibility layer to run Windows/macOS programs on Linux.
|
||||
|
||||
But that doesn’t work all the time. For instance, you do not have official Microsoft 365 support for Linux and tools like Wallpaper Engine.
|
||||
|
||||
#### Not a Gaming-first OS
|
||||
|
||||
![gaming illustration][21]
|
||||
|
||||
If you want to game on your computer, Windows remains the best option for its support for the newest hardware and technologies.
|
||||
|
||||
When it comes to Linux, there are a lot of “ifs and buts” for a clear answer. You can refer to our [gaming guide for Linux][22] to explore more if interested.
|
||||
|
||||
#### Lack of Professional Tech Support
|
||||
|
||||
I know not everyone needs it. But, there are tech support options that can guide users/fix issues remotely on their laptop or computer.
|
||||
|
||||
With Linux, you can seek help from the community, but it may not be as seamless as some professional tech support services.
|
||||
|
||||
You’ll still have to do most of the hit and try stuff on your own and not everyone would like it.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
I am primarily a Linux user but I use Windows when I have to play games. Though my preference is Linux, I have tried to be unbiased and give you enough pointers so that you can make up your mind if Linux is for you or not.
|
||||
|
||||
If you are going for Linux and have never used it, take the baby step and [use Linux in a virtual machine first][23]. You can also use WSL2 if you have Windows 11.
|
||||
|
||||
I welcome your comments and suggestions.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/advantages-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/what-is-linux/
|
||||
[2]: https://itsfoss.com/what-is-linux/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/08/open-source-proprietary-illustration.jpg
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/08/linux-mint-21-resource-usage.jpg
|
||||
[5]: https://itsfoss.com/lightweight-linux-beginners/
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/09/malware-illustration.jpg
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/08/pop-os-screenshot-2022.png
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/09/customization-reddit-unixporn.jpg
|
||||
[9]: https://www.reddit.com/r/unixporn/comments/wzu5nl/plasma_cscx2n/
|
||||
[10]: https://itsfoss.com/kde-customization/
|
||||
[11]: https://itsfoss.com/best-linux-docks/
|
||||
[12]: https://itsfoss.com/beautiful-linux-distributions/
|
||||
[13]: https://itsfoss.com/wp-content/uploads/2022/09/job-illustration.jpg
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/09/privacy-windows.webp
|
||||
[15]: https://itsfoss.com/raspberry-pi-alternatives/
|
||||
[16]: https://itsfoss.com/wp-content/uploads/2022/09/too-much-learn-illustration.jpg
|
||||
[17]: https://itsfoss.com/mac-linux-difference/
|
||||
[18]: https://itsfoss.com/best-linux-beginners/
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2017/09/linux-desktop-market-share.jpg
|
||||
[20]: https://itsfoss.com/linux-market-share/
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/08/gaming-illustration.jpg
|
||||
[22]: https://itsfoss.com/linux-gaming-guide/
|
||||
[23]: https://itsfoss.com/why-linux-virtual-machine/
|
@ -0,0 +1,101 @@
|
||||
[#]: subject: "Defining an open source AI for the greater good"
|
||||
[#]: via: "https://opensource.com/article/22/10/defining-open-source-ai"
|
||||
[#]: author: "Stefano Maffulli https://opensource.com/users/reed"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Defining an open source AI for the greater good
|
||||
======
|
||||
Join the conversation by joining the four Deep Dive: AI panel discussions starting on October 11.
|
||||
|
||||
Artificial intelligence (AI) has become more prevalent in our daily lives. While AI systems may intend to offer users convenience, there have been numerous examples of automated tools getting it wrong, resulting in serious consequences. What's happening in the AI system that leads to erroneous and harmful conclusions? Probably a dramatic combo of bad AI combined with a lack of human oversight. How do we as a society prevent AI ethics fails?
|
||||
|
||||
The open source community has had, for well over 20 years, clear processes for dealing with errors ("bugs") in software. The [Open Source Definition][2] firmly establishes the rights of developers and the rights of users. There are frameworks, licenses, and a legal understanding of what needs to be done. When you find a bug, you know who to blame, you know where to report it, and you know how to fix it. But when it comes to AI, do you have the same understanding of what you need to do in order to fix a bug, error, or bias?
|
||||
|
||||
In reality, there are many facets of AI that don't fit neatly into the Open Source Definition.
|
||||
|
||||
### Establishing boundaries for AI
|
||||
|
||||
What's the boundary between the data that trains an AI system and the software itself? In many ways, AI systems are like black boxes: it isn't really understood what happens inside, and very little insight for how a system has reached a specific conclusion. You can't inspect the networks inside that are responsible for making a judgment call. So how can open source principles apply to these "black boxes" making automated decisions?
|
||||
|
||||
For starters, you need to take a step back and understand what goes into an AI's automated decision-making process.
|
||||
|
||||
### The AI decision process
|
||||
|
||||
The AI process starts with collecting vast amounts of training data-data scraped from the internet, tagged and cataloged, and fed into a model to teach it how to make decisions on its own. However, the process of collecting a set of training data is itself problematic. It's a very expensive and time-consuming endeavor, so large corporations are better positioned to have the resources to build large training sets. Companies like Meta (Facebook) and Alphabet (Google) have been collecting people's data and images for a long, long time. (Think of all the pictures you've uploaded since before Facebook or even MySpace existed. I've lost track of all the pictures I've put online!) Essentially anything on the Internet is fair game for data collection, and today mobile phones are basically real-time sensors feeding data and images to a few mega-corporations and then to Internet-scrapers.
|
||||
|
||||
Examining the data going into the system is just scratching the surface. I haven't yet addressed the models and neural networks themselves. What's in an AI model? How do you know when you're chatting with a bot? How do you inspect it? How do you flag an issue? How do we fix it? How do we stop it in case it gets out of control?
|
||||
|
||||
It's no wonder that governments around the world are not only excited about AI and the good that AI could do, but also very concerned about the risks. How do we protect each other, and how do we ask for a *fair* AI? How do we establish not just rules and regulations, but also social norms that help us all define and understand acceptable behavior? We're just now beginning to ask these questions, and only just starting to identify all the pieces that need to be examined and considered.
|
||||
|
||||
To date, there aren't any guiding principles or guardrails to orient the conversation between stakeholders in the same way that, for instance, the [GNU Manifesto][3] and later the Open Source Definition provides. So far, everyone (corporations, governments, academia, and others) has moved at their own pace, and largely for their own self-interests. That's why the Open Source Initiative (OSI) has stepped forward to initiate a collaborative conversation.
|
||||
|
||||
### Open Source Initiative
|
||||
|
||||
The Open Source Initiative has launched [Deep Dive: AI][4], a three-part event to uncover the peculiarities of AI systems, to build understanding around where guardrails are needed, and to define Open Source in the context of AI. Here's a sampling of what the OSI has discovered so far.
|
||||
|
||||
#### Copyright
|
||||
|
||||
AI models may not be covered by copyright. Should they be?
|
||||
|
||||
Developers, researchers, and corporations share models publicly, some with an Open Source software license. Is that the right thing to do?
|
||||
|
||||
The output of AI may not be covered by copyright. That raises an interesting question: Do we want to apply copyright to this new kind of artifact? After all, copyleft was invented as a hack for copyright. Maybe this is the chance to create an alternative legal framework.
|
||||
|
||||
The release of the new Stable Diffusion model raises issues around the output of the models. Stable Diffusion has been trained on lots of images, including those owned by Disney. When you ask it to, for instance, create a picture of Mickey Mouse going to the US Congress, it spits out an image that looks exactly like Mickey Mouse in front of the US Capitol Building. That image may not be covered by copyright, but I bet you that the moment someone sells t-shirts with these pictures on it, Disney will have something to say about it.
|
||||
|
||||
No doubt we'll have a test case soon. Until then, delve more into the copyright conundrum in the **Deep Dive: AI** podcast [Copyright, selfie monkeys, the hand of God][5].
|
||||
|
||||
#### Regulation
|
||||
|
||||
The European Union is leading the way on AI regulation, and its approach is interesting. The AI Act is an interesting read. It's still in draft form, and it could be some time before it is approved, but its legal premise is based on risk. As it stands now, EU legislation would require extensive testing and validation, even on AI concepts that are still in their rudimentary research stages. Learn more about the EU’s legislative approach in the Deep Dive: AI podcast [Solving for AI’s black box problem][6].
|
||||
|
||||
#### Datasets
|
||||
|
||||
Larger datasets raise questions. Most of the large, publicly available datasets that are being used to train AI models today comprise data taken from the web. These datasets are collected by scraping massive amounts of publicly available data and also data that is available to the public under a wide variety of licenses. The legal conditions for using this raw data are not clear. This means machines are assembling petabytes of images with dubious provenance, not only because of questionable legal rights associated with the uses of these images, code and text, but also because of the often illicit content. Furthermore, we must acknowledge that this internet data has been produced by the wealthier segment of the world's population—the people with access to the internet and smartphones. This inherently skews the data. Find out more about this topic in the Deep Dive: AI podcast [When hackers take on AI: Sci-fi – or the future?][7]
|
||||
|
||||
#### Damage control
|
||||
|
||||
AI can do real damage. Deep fakes are a good example. A Deep Fake AI tool enables you to impose the face of someone over the body of someone else. They're popular tools in the movie industry, for example. Deep Fake tools are unfortunately used also for nefarious purposes, such as making it appear that someone is in a compromising situation, or to distribute malicious misinformation. Learn more about Deep Fakes in Deep Dive: AI podcast [Building creative restrictions to curb AI abuse][8].
|
||||
|
||||
Another example is the *stop button* problem, where a machine trained to win a game can become so aware that it needs to win that it becomes resistant to being stopped. It sounds like science fiction, but it is an identified mathematical problem that research communities are aware of, and have no immediate solution for.
|
||||
|
||||
#### Hardware access
|
||||
|
||||
Currently, no real Open Source hardware stack for AI exists. Only an elite few have access to the hardware required for serious AI training and research. The volume of data consumed and generated by AI is measured in terabytes and petabytes, which means that special hardware is required to perform speedy computations on data sets of this size. Specifically, without graphic processing units (GPUs), an AI computation could take years instead of hours. Unfortunately, the hardware required to build and run these big AI models is proprietary, expensive, and requires special knowledge to set up. There are a limited number of organizations that have the resources to use and govern the technology.
|
||||
|
||||
Individual developers simply don't have the resources to purchase the hardware needed to run these data sets. A few vendors are beginning to release hardware with Open Source code, but the ecosystem is not mature. Learn more about the hardware requirements of AI in the Deep Dive: AI podcast [Why Debian won’t distributed AI models anytime soon][9].
|
||||
|
||||
### AI challenges
|
||||
|
||||
The [Open Source Initiative][10] protects open source against many threats today, but also anticipates the challenges, such as AI, of tomorrow. AI is a promising field, but it can also deliver disappointing results. Some AI guardrails are needed to protect creators, users, and the world at large.
|
||||
|
||||
The Open Source Initiative is actively encouraging dialogue. We need to understand the issues and implications and help communities establish shared principles that ensure AI is good for us all. Join the conversation by joining the four [Deep Dive: AI panel discussions][11] starting on October 11.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/defining-open-source-ai
|
||||
|
||||
作者:[Stefano Maffulli][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/reed
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/brain_computer_solve_fix_tool.png
|
||||
[2]: https://opensource.org/osd
|
||||
[3]: https://www.gnu.org/gnu/manifesto.en.html
|
||||
[4]: https://deepdive.opensource.org/
|
||||
[5]: https://deepdive.opensource.org/podcast/copyright-selfie-monkeys-the-hand-of-god/
|
||||
[6]: https://deepdive.opensource.org/podcast/solving-for-ais-black-box-problem/
|
||||
[7]: https://deepdive.opensource.org/podcast/when-hackers-take-on-ai-sci-fi-or-the-future/
|
||||
[8]: https://deepdive.opensource.org/podcast/building-creative-restrictions-to-curb-ai-abuse
|
||||
[9]: https://deepdive.opensource.org/podcast/why-debian-wont-distribute-ai-models-any-time-soon/
|
||||
[10]: https://opensource.org
|
||||
[11]: https://deepdive.opensource.org/
|
@ -1,191 +0,0 @@
|
||||
[#]: subject: (Write your first web component)
|
||||
[#]: via: (https://opensource.com/article/21/7/web-components)
|
||||
[#]: author: (Ramakrishna Pattnaik https://opensource.com/users/rkpattnaik780)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (cool-summer-021)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Write your first web component
|
||||
======
|
||||
Don't repeat yourself; create elements you can reuse when writing web
|
||||
apps for any browser.
|
||||
![Digital creative of a browser on the internet][1]
|
||||
|
||||
Web components are a collection of open source technologies such as JavaScript and HTML that allow you to create custom elements that you can use and reuse in web apps. The components you create are independent of the rest of your code, so they're easy to reuse across many projects.
|
||||
|
||||
Best of all, it's a platform standard supported by all major modern browsers.
|
||||
|
||||
### What's in a web component?
|
||||
|
||||
* **Custom elements:** This JavaScript API allows you to define new types of HTML elements.
|
||||
* **Shadow DOM:** This JavaScript API provides a way to attach a hidden separate [Document Object Model][2] (DOM) to an element. This encapsulates your web component by keeping the styling, markup structure, and behavior isolated from other code on the page. It ensures that styles are not overridden by external styles or, conversely, that a style from your web component doesn't "leak" into the rest of the page**.**
|
||||
* **HTML templates:** The element allows you to define reusable DOM elements. The element and its contents are not rendered in the DOM but can still be referenced using JavaScript.
|
||||
|
||||
|
||||
|
||||
### Write your first web component
|
||||
|
||||
You can write a simple web component with your favorite text editor and JavaScript. This how-to uses bootstrap to generate simple stylings then creates a simple card web component to display the temperature of a location passed to it as an attribute. The component uses the [Open Weather API][3], which requires you to generate an APPID/APIKey by signing in.
|
||||
|
||||
The syntax of calling this web component requires the location's longitude and latitude:
|
||||
|
||||
|
||||
```
|
||||
`<weather-card longitude='85.8245' latitude='20.296' />`
|
||||
```
|
||||
|
||||
Create a file named **weather-card.js** that will contain all the code for your web component. Start by defining your component. This can be done by creating a template element and adding some simple HTML elements into it:
|
||||
|
||||
|
||||
```
|
||||
const template = document.createElement('template');
|
||||
|
||||
template.innerHTML = `
|
||||
<div class="card">
|
||||
<div class="card-body"></div>
|
||||
</div>
|
||||
`
|
||||
```
|
||||
|
||||
Start defining the WebComponent class and its constructor:
|
||||
|
||||
|
||||
```
|
||||
class WeatherCard extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this._shadowRoot = this.attachShadow({ 'mode': 'open' });
|
||||
this._shadowRoot.appendChild(template.content.cloneNode(true));
|
||||
}
|
||||
….
|
||||
}
|
||||
```
|
||||
|
||||
The constructor attaches the shadowRoot and sets it to open mode. Then the template is cloned to shadowRoot.
|
||||
|
||||
Next, access the attributes. These are the longitude and latitude, and you need them to make a GET request to the Open Weather API. This needs to be done in the `connectedCallback` function. You can use the `getAttribute` method to access the attributes or define getters to bind them to this object:
|
||||
|
||||
|
||||
```
|
||||
get longitude() {
|
||||
return this.getAttribute('longitude');
|
||||
}
|
||||
|
||||
get latitude() {
|
||||
return this.getAttribute('latitude');
|
||||
}
|
||||
```
|
||||
|
||||
Now define the `connectedCallBack` method that fetches weather data whenever it is mounted:
|
||||
|
||||
|
||||
```
|
||||
connectedCallback() {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
const url = `[http://api.openweathermap.org/data/2.5/weather?lat=${this.latitude}\&lon=${this.longitude}\&appid=API\\_KEY\\`][4]
|
||||
xmlHttp.open("GET", url, false);
|
||||
xmlHttp.send(null);
|
||||
this.$card = this._shadowRoot.querySelector('.card-body');
|
||||
let responseObj = JSON.parse(xmlHttp.responseText);
|
||||
let $townName = document.createElement('p');
|
||||
$townName.innerHTML = `Town: ${responseObj.name}`;
|
||||
this._shadowRoot.appendChild($townName);
|
||||
let $temperature = document.createElement('p');
|
||||
$temperature.innerHTML = `${parseInt(responseObj.main.temp - 273)} &deg;C`
|
||||
this._shadowRoot.appendChild($temperature);
|
||||
}
|
||||
```
|
||||
|
||||
Once the weather data is retrieved, additional HTML elements are added to the template. Now, your class is defined.
|
||||
|
||||
Finally, define and register a new custom element by using the method `window.customElements.define`:
|
||||
|
||||
|
||||
```
|
||||
`window.customElements.define('weather-card', WeatherCard);`
|
||||
```
|
||||
|
||||
The first argument is the name of the custom element, and the second argument is the defined class. Here's a [link to the entire component][5].
|
||||
|
||||
You've written your first web component! Now it's time to bring it to the DOM. To do that, you must load the JavaScript file with your web component definition in your HTML file (name it **index.html**):
|
||||
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<weather-card longitude='85.8245' latitude='20.296'></weather-card>
|
||||
<script src='./weather-card.js'></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
```
|
||||
|
||||
Here's your web component in a browser:
|
||||
|
||||
![Web component displayed in a browser][6]
|
||||
|
||||
(Ramakrishna Pattnaik, [CC BY-SA 4.0][7])
|
||||
|
||||
Because web components need only HTML, CSS, and JavaScript, they are natively supported by browsers and can be used seamlessly with frontend frameworks, including React and Vue. The following simple code snippet shows how to use web components with a simple React App bootstrapped with [Create React App][8]. For this, you need to import the **weather-card.js** file you defined earlier and use it as a component:
|
||||
|
||||
|
||||
```
|
||||
import './App.css';
|
||||
import './weather-card';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<weather-card longitude='85.8245' latitude='20.296'></weather-card>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
### Lifecycle of a web component
|
||||
|
||||
All components follow a lifecycle from initialization to removal from the DOM (i.e., unmount). Methods are associated with each lifecycle event so that you can control the components better. The various lifecycle events of a web component include:
|
||||
|
||||
* **Constructor:** The constructor for a web component is called before it is mounted, meaning it's created before the element is attached to the document. It's used for initializing local state, binding event handlers, and creating the shadow DOM. The constructor must make a call to `super()` to call the class the Web Component class extends.
|
||||
* **ConnectedCallBack:** This is called when an element is mounted (that is, inserted into the DOM tree). It deals with initializations creating DOM nodes and is used mostly for operations like instantiating network requests. React developers can relate it to `componentDidMount`.
|
||||
* **attributeChangedCallback:** This method accepts three arguments: `name`, `oldValue`, and `newValue`. It is called whenever one of the component's observed attributes gets changed. Attributes are declared observed attributes using a static `observedAttributes` getter: [code] static get observedAttributes() {
|
||||
return ['name', '_id'];
|
||||
} [/code] `attributeChangedCallback` will be called whenever the attribute name or `_id` is changed.
|
||||
* **DisconnectedCallBack:** This is called when an element is removed from the DOM tree (i.e., unmounted). It is equivalent to React's `componentWillUnmount`. It is used to free resources that won't be garbage-collected automatically, like unsubscribing from DOM events, stopping interval timers, or unregistering all registered callbacks.
|
||||
* **AdoptedCallback:** It is called each time the custom element is moved to a new document. It only occurs when dealing with IFrames.
|
||||
|
||||
|
||||
|
||||
### Modular open source
|
||||
|
||||
Web components can be a powerful way to develop web apps. Whether you're comfortable with JavaScript or just getting started with it, it's easy to create reusable code with this great open standard, no matter what browser your target audience uses.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/web-components
|
||||
|
||||
作者:[Ramakrishna Pattnaik][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/rkpattnaik780
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet)
|
||||
[2]: https://en.wikipedia.org/wiki/Document_Object_Model
|
||||
[3]: https://openweathermap.org/api
|
||||
[4]: http://api.openweathermap.org/data/2.5/weather?lat=${this.latitude}\&lon=${this.longitude}\&appid=API\_KEY\`
|
||||
[5]: https://gist.github.com/rkpattnaik780/acc683d3796102c26c1abb03369e31f8
|
||||
[6]: https://opensource.com/sites/default/files/uploads/webcomponent.png (Web component displayed in a browser)
|
||||
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[8]: https://create-react-app.dev/docs/getting-started/
|
@ -1,192 +0,0 @@
|
||||
[#]: subject: "Reasons for servers to support IPv6"
|
||||
[#]: via: "https://jvns.ca/blog/2022/01/29/reasons-for-servers-to-support-ipv6/"
|
||||
[#]: author: "Julia Evans https://jvns.ca/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Reasons for servers to support IPv6
|
||||
======
|
||||
|
||||
I’ve been having a hard time understanding IPv6. On one hand, the basics initially seem pretty straightforward (there aren’t enough IPv4 addresses for all the devices on the internet, so people invented IPv6! There are enough IPv6 addresses for everyone!)
|
||||
|
||||
But when I try to actually understand it, I run into a lot of questions. One question is: `twitter.com` does not support IPv6. Presumably it can’t be causing them THAT many issues to not support it. So why _do_ websites support IPv6?
|
||||
|
||||
I asked people on Twitter [why their servers support IPv6][1] and I got a lot of great answers, which I’ll summarize here. These all come with the disclaimer that I have basically 0 experience with IPv6 so I can’t evaluate these reasons very well.
|
||||
|
||||
First though, I want to explain why it’s possible for `twitter.com` to not support IPv6 because I didn’t understand that initially.
|
||||
|
||||
### how can you tell `twitter.com` doesn’t support IPv6?
|
||||
|
||||
You can tell they don’t support IPv6 is because if you look up their AAAA record (which contains their IPv6 address), there isn’t one. Some other big sites like `github.com` and `stripe.com` also don’t support IPv6.
|
||||
|
||||
```
|
||||
|
||||
$ dig AAAA twitter.com
|
||||
(empty response)
|
||||
$ dig AAAA github.com
|
||||
(empty response)
|
||||
$ dig AAAA stripe.com
|
||||
(empty response)
|
||||
|
||||
```
|
||||
|
||||
### why does `twitter.com` still work for IPv6 users?
|
||||
|
||||
I found this really confusing, because I’ve always heard that lots of internet users are forced to use IPv6 because we’ve run out of IPv4 addresses. But if that’s true, how could twitter.com continue to work for those people without IPv6 support? Here’s what I learned from the Twitter thread yesterday.
|
||||
|
||||
There are two kinds of internet service providers (ISPs):
|
||||
|
||||
1. ISPs who own enough IPv4 address for all of their customers
|
||||
2. ISPs who don’t
|
||||
|
||||
|
||||
|
||||
My ISP is in category 1 – my computer gets its own IPv4 address, and actually my ISP doesn’t even support IPv6 at all.
|
||||
|
||||
But lots of ISPs (especially outside of North America) are in category 2: they don’t have enough IPv4 addresses for all their customers. Those ISPs handle the problem by:
|
||||
|
||||
* giving all of their customers a unique IPv6 address, so they can access IPv6 sites directly
|
||||
* making large groups of their customers _share_ IPv4 addresses. This can either be with CGNAT (”[carrier-grade NAT][2]”) or “464XLAT” or maybe something else.
|
||||
|
||||
|
||||
|
||||
All ISPs need _some_ IPv4 addresses, otherwise it would be impossible for their customers to access IPv4-only sites like twitter.com.
|
||||
|
||||
### what are the reasons to support IPv6?
|
||||
|
||||
Now we’ve explained why it’s possible to _not_ support IPv6. So why support it? There were a lot of reasons.
|
||||
|
||||
### reason: CGNAT is a bottleneck
|
||||
|
||||
The argument that was most compelling to me was: CGNAT (carrier-grade NAT) is a bottleneck and it causes performance issues, and it’s going to continue to get worse over time as access to IPv4 addresses becomes more and more restricted.
|
||||
|
||||
Someone also mentioned that because CGNAT is a bottleneck, it’s an attractive DDoS target because you can ruin lots of people’s internet experience just by attacking 1 server.
|
||||
|
||||
Servers supporting IPv6 reduces the need for CGNAT (IPv6 users can just connect directly!) which makes the internet work better for everyone.
|
||||
|
||||
I thought this argument was interesting because it’s a “public commons” / community argument – it’s less that supporting IPv6 will make your site specifically work better, and more that if _almost everyone_ supports IPv6 then it’ll make the experience of the internet better for everyone, especially in countries where people don’t have easy access to IPv4 addresses.
|
||||
|
||||
I don’t actually know how much of an issue this is in practice.
|
||||
|
||||
There were lots of more selfish arguments to use IPv6 too though, so let’s get into those.
|
||||
|
||||
### reason: so IPv6-only servers can access your site
|
||||
|
||||
I said before that most IPv6 users still have access to IPv4 though some kind of NAT. But apparently that’s not true for everyone – some people mentioned that they run some servers which only have IPv6 addresses and which aren’t behind any kind of NAT. So those servers are actually totally unable to access IPv4-only sites.
|
||||
|
||||
I imagine that those servers aren’t connecting to arbitrary machines that much – maybe they only need to connect to a few hosts with IPv6 support.
|
||||
|
||||
But it makes sense to me that a machine should be able to access my site even if it doesn’t have an IPv4 address.
|
||||
|
||||
### reason: better performance
|
||||
|
||||
For users who are using both IPv4 and IPv6 (with a dedicated IPv6 address and a shared IPv4 address), apparently IPv6 is often faster because it doesn’t need to go through an extra translation layer.
|
||||
|
||||
So supporting IPv6 can make the site faster for users sometimes.
|
||||
|
||||
In practice clients use an algorithm called “Happy Eyeballs” which tries to figure out whether IPv4 or IPv6 will be faster and then uses whichever seems faster.
|
||||
|
||||
Some other performance benefits people mentioned:
|
||||
|
||||
* maybe sometimes using IPv6 can get you a SEO boost because of the better performance.
|
||||
* maybe using IPv6 causes you to go through better (faster) network hardware because it’s a newer protocol
|
||||
|
||||
|
||||
|
||||
### reason: resilience against IPv4 internet outages
|
||||
|
||||
One person said that they’ve run into issues where there was an internet outage that only affected IPv4 traffic, because of accidental BGP poisoining.
|
||||
|
||||
So supporting IPv6 means that their site can still stay partially online during those outages.
|
||||
|
||||
### reason: to avoid NAT issues with home servers
|
||||
|
||||
A few people mentioned that it’s much easier to use IPv6 with home servers – instead of having to do port forwarding through your router, you can just give every server a unique IPv6 address and then access it directly.
|
||||
|
||||
Of course, for this to work the client needs to have IPv6 support, but more and more clients these days have IPv6 support too.
|
||||
|
||||
### reason: to own your IP addresses
|
||||
|
||||
Apparently you can buy IPv6 addresses, use them for the servers on your home network, and then if you change your ISP, continue to use the same IP addresses?
|
||||
|
||||
I’m still not totally sure how this works (I don’t know how you would convince computers on the internet to actually route those IPs to you? I guess you need to run your own AS or something?).
|
||||
|
||||
### reason: to learn about IPv6
|
||||
|
||||
One person said they work in security and in security it’s very important to understand how internet protocols work (attackers are using internet protocols!). So running an IPv6 server helps them learn how it works.
|
||||
|
||||
### reason: to push IPv6 forward / IPv4 is “legacy”
|
||||
|
||||
A couple of people said that they support IPv6 because it’s the current standard, and so they want to contribute to the success of IPv6 by supporting it.
|
||||
|
||||
A lot of people also said that they support IPv6 because they think sites that only support IPv4 are “behind” or “legacy”.
|
||||
|
||||
### reason: it’s easy
|
||||
|
||||
I got a bunch of answers along the lines of “it’s easy, why not”. Obviously adding IPv6 support is not easy in all situations, but a couple of reasons it might be easy in some cases:
|
||||
|
||||
* you automatically got an IPv6 address from your hosting company, so all you need to do is add an `AAAA` record pointing to that address
|
||||
* your site is behind a CDN that supports IPv6, so you don’t need to do anything extra
|
||||
|
||||
|
||||
|
||||
### reason: safer networking experimentation
|
||||
|
||||
Because the address space is so big, if you want to try something out you can just grab an IPv6 subnet, try out some things in it, and then literally never use that subnet again.
|
||||
|
||||
### reason: to run your own autonomous system (AS)
|
||||
|
||||
A few people said they were running their own autonomous system (I talked about what an AS is a bit in this [BGP post][3]). IPv4 addresses are too expensive so they bought IPv6 addresses for their AS instead.
|
||||
|
||||
### reason: security by obscurity
|
||||
|
||||
If your server _only_ has a public IPv6 address, attackers can’t easily find it by scanning the whole internet. The IPv6 address space is too big to scan!
|
||||
|
||||
Obviously this shouldn’t be your only security measure, but it seems like a nice bonus – any time I run an IPv4 public server I’m always a tiny bit surprised by how it’s constantly being scanned for vulnerabilities (like old versions of WordPress, etc).
|
||||
|
||||
### very silly reason: you can put easter eggs in your IPv6 address
|
||||
|
||||
IPv6 addresses have a lot of extra bits in them that you can do frivolous things with. For example one of Facebook’s IPv6 addresses is “2a03:2880:f10e:83:face:b00c:0:25de” (it has `face:b00c` in it).
|
||||
|
||||
### there are more reasons than I thought
|
||||
|
||||
That’s all I’ve learned about the “why support IPv6?” question so far.
|
||||
|
||||
I came away from this conversation more motivated to support IPv6 on my (very small) servers than I had been before. But that’s because I think supporting IPv6 will require very little effort for me. (right now I’m using a CDN that supports IPv6 so it comes basically for free)
|
||||
|
||||
I know very little about IPv6 still but my impression is that IPv6 support often isn’t zero-effort and actually can be a lot of work. For example, I have no idea how much work it would actually be for Twitter to add IPv6 support on their edge servers.
|
||||
|
||||
### some more IPv6 questions
|
||||
|
||||
Here are some more IPv6 questions I have that maybe I’ll explore later:
|
||||
|
||||
* what are the _disadvantages_ to supporting IPv6? what goes wrong?
|
||||
* what are the incentives for ISPs that own enough IPv4 addresses for their customers to support IPv6? (another way of asking: is it likely that my ISP will move to supporting IPv6 in the next few years? or are they just not incentivized to do it so it’s unlikely?)
|
||||
* [digital ocean][4] seems to only support IPv4 floating IPs, not IPv6 floating IPs. Why not? Shouldn’t it be _easier_ to give out IPv6 floating IPs since there are more of them?
|
||||
* when I try to ping an IPv6 address (like example.com’s IP `2606:2800:220:1:248:1893:25c8:1946` for example) I get the error `ping: connect: Network is unreachable`. Why? (answer: it’s because my ISP doesn’t support IPv6 so my computer doesn’t have a public IPv6 address)
|
||||
|
||||
|
||||
|
||||
This [IPv4 vs IPv6 article from Tailscale][5] looks interesting and answers some of these questions.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2022/01/29/reasons-for-servers-to-support-ipv6/
|
||||
|
||||
作者:[Julia Evans][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://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://twitter.com/b0rk/status/1487156306884636672
|
||||
[2]: https://en.wikipedia.org/wiki/Carrier-grade_NAT
|
||||
[3]: https://jvns.ca/blog/2021/10/05/tools-to-look-at-bgp-routes/
|
||||
[4]: https://docs.digitalocean.com/products/networking/floating-ips/
|
||||
[5]: https://tailscale.com/kb/1134/ipv6-faq/
|
@ -1,5 +1,5 @@
|
||||
[#]: subject: "slimmer emacs with kitty"
|
||||
[#]: via: "https://jao.io/blog/2022-06-08-slimmer-emacs-with-kitty.html"
|
||||
[#]: via: "https://jao.io/blog/slimmer-emacs-with-kitty.html"
|
||||
[#]: author: "jao https://jao.io"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
@ -69,7 +69,7 @@ The gist of it is pretty simple though, and it's basically distilled in [this se
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jao.io/blog/2022-06-08-slimmer-emacs-with-kitty.html
|
||||
via: https://jao.io/blog/slimmer-emacs-with-kitty.html
|
||||
|
||||
作者:[jao][a]
|
||||
选题:[lujun9972][b]
|
||||
@ -87,8 +87,8 @@ via: https://jao.io/blog/2022-06-08-slimmer-emacs-with-kitty.html
|
||||
[5]: https://sw.kovidgoyal.net/kitty/
|
||||
[6]: https://codeberg.org/jao/elibs/src/branch/main/data/kitty.conf
|
||||
[7]: https://en.wikipedia.org/wiki/HarfBuzz
|
||||
[8]: tmp.aRLm0IGxe1#fn.1
|
||||
[9]: tmp.aRLm0IGxe1#fnr.1
|
||||
[8]: tmp.cmx0w4nr81#fn.1
|
||||
[9]: tmp.cmx0w4nr81#fnr.1
|
||||
[10]: https://codeberg.org/jao/elibs/src/main/init.el#L1595
|
||||
[11]: https://jao.io/blog/tags.html
|
||||
[12]: https://jao.io/blog/tag-emacs.html
|
||||
|
117
sources/tech/20220619 simple note taking.md
Normal file
117
sources/tech/20220619 simple note taking.md
Normal file
@ -0,0 +1,117 @@
|
||||
[#]: subject: "simple note taking"
|
||||
[#]: via: "https://jao.io/blog/2022-06-19-simple-note-taking.html"
|
||||
[#]: author: "jao https://jao.io"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
simple note taking
|
||||
======
|
||||
|
||||
I was just watching [Prot's explanation][1] of his new package _denote_, a very elegant note-taking system with a stress on simplicity and, as the author puts it, low-tech requirements. Now, those are excellent qualities in my book, and i think i'd quickly become a _denote_ user if it weren't for the fact that i already have a homegrown set of utilities following a similar philosophy. Inevitably, they differ in some details, as is to be expected from software that has grown with me, as Prot's with him, during more than a decade, but they are similar in important ways.
|
||||
|
||||
I've had in mind writing a brief note on my notes utilities for a while, so i guess this is a good time for it: i can, after showing you mine, point you to a polished package following a similar philosophy and sidestep any temptation of doing anything similar with my little functions :)
|
||||
|
||||
![][2]
|
||||
|
||||
As you'll see in a moment, in some ways, my note taking system is even simpler than Prot's, while in others i rely on more sophisticated software, essentially meaning that where _denote_ is happy to use dired and filenames, i am using grep over the front-matter of the notes. So if you loved the filename-as-metadata idea in _denote_, you can skip the rest of this post!
|
||||
|
||||
These are the main ideas around which i built my note-taking workflow:
|
||||
|
||||
* Personally, i have such a dislike for non-human readable identifiers, that i cannot even stand those 20221234T142312 prefixes (for some reason, i find them quite hard to read and distracting). When i evolved my notes collection, i wanted my files to be named by their title and nothing more. I am also pretty happy to limit myself to org-mode files. So i wanted a directory of (often short) notes with names like `the-lisp-machine.org`, `david-foster-wallace.org` or `combinator-parsing-a-short-tutorial.org`.[1][3]
|
||||
* I like tags, so all my notes, besides a title, are going to have attached a list of them (_denote_ puts them in the filename and inside the file's headers; i'm content with the latter, because, as you'll see in a moment, i have an easy way of searching through that contents).
|
||||
* I'm not totally averse to hierarchies: besides tagging, i put my notes in a subdirectory indicating their broad category. I can then quickly narrow my searches to a general _theme_ if needed[2][4].
|
||||
* As mentioned, i want to be able to search by the title and tag (besides more broadly by contents) of my notes. Since that's all information available in plain text in the files, `grep` and family (via their emacs lovely helpers) are all that is needed; but i can easily go a step further and use other indexers of plain text like, say, recoll (via my [consult-recoll package][5]).
|
||||
* It must be easy to quickly create notes that link to any contents i'm seeing in my emacs session, be it text, web, pdf, email, or any other. That comes for free thanks to org and `org-capture`.
|
||||
* I want the code i have to write to accomplish all the above to be short and sweet, let's say well below two hundred lines of code.
|
||||
|
||||
|
||||
|
||||
Turns out that i was able to write a little emacs lisp library doing all the above, thanks to the magic of org-mode and consult: you can find it over at my repo by the name of [jao-org-notes.el][6]. The implementation is quite simple and is based on having all note files in a parent directory (`jao-org-notes-dir`) with a subfolder for each of the main top-level categories, and, inside each of them, note files in org mode with a preamble that has the structure of this example:
|
||||
|
||||
```
|
||||
|
||||
#+title: magit tips
|
||||
#+date: <2021-07-22 Thu>
|
||||
#+filetags: git tips
|
||||
|
||||
```
|
||||
|
||||
The header above corresponds to the note in the file `emacs/magit-tips.org`. Now, it's very easy to write a new command to ask for a top-level category and a list of tags and insert a header like that in a new file: it's called [jao-org-notes-open-or-create][7] in my little lib, and with it one can define a new org template:
|
||||
|
||||
```
|
||||
|
||||
("N" "Note" plain (file jao-org-notes-open-or-create)
|
||||
"\n- %a\n %i"
|
||||
:jump-to-captured t)
|
||||
|
||||
```
|
||||
|
||||
that one can then add to `org-capture-templates` (above, i'm using "N" as its shortcut; in the package, this is done by [jao-org-notes-setup][8], which takes the desired shortcut as a parameter). I maintain a simple list of possible tags in the variable `jao-org-notes--tags`, whose value is persisted in the file denoted by the value `jao-org-notes-tags-cache-file`, so that we can remember newly-added tags; with that and the magic of emacs's completing read, handling tags is a breeze.
|
||||
|
||||
Now for search. These are text files, so if i want to search for contents, i just need grepping, for instance with `M-x rgrep` or, even better, `M-x consult-ripgrep`. That is what the command [jao-org-notes-grep][9] does.
|
||||
|
||||
But it is also very useful to be able to limit searches to the title and tags of the notes: that's what the command [jao-org-notes-open][10] does using `consult` and `ripgrep` by the very simple device of searching for regular expressions in the first few lines of each file that start with either `#+title:` or `#+filetags:` followed by the terms we're looking for. That's something one could already do with `rgrep` alone; what consult adds to the party is the ability of displaying the matching results nicely formatted:
|
||||
|
||||
![][11]
|
||||
|
||||
Links between notes are simply org `file:` links, and having a simple "backlinks" command is, well, simple if you don't want anything fancy[3][12]. A command to insert a new link to another note is so boring to almost not meriting mention (okay, almost: [jao-org-notes-insert-link][13]).
|
||||
|
||||
And that's about it. With those simple commands and in about 160 lines of code i find myself comfortably managing plain text notes, and easily finding contents within them. I add a bit of icing by asking [Recoll][14] to index my notes directory (as well as my email and PDFs): it is clever enough to parse org files, and give you back pointers to the sections in the files, and then issue queries with the comfort of a consult asynchronous command thanks to [consult-recoll][5] (the screenshot in the introduction is just me using it). It's a nice use case of how having little, uncomplicated packages that don't try to be too sophisticated and center on the functionality one really needs makes it very easy to combine solutions in beatiful ways[4][15].
|
||||
|
||||
### Footnotes:
|
||||
|
||||
[1][16]
|
||||
|
||||
I also hate with a passion those `:PROPERTIES:` drawers and other metadata embellishments so often used in org files, and wanted to avoid them as much as possible, so i settled with the only mildly annoying `#+title` and friends at the beginning of the files and nothing more. The usual caveat that that makes it more difficult to have unique names has proven a non-problem to me over the years.
|
||||
|
||||
[2][17]
|
||||
|
||||
Currently i use `work`, `books`, `computers`, `emacs`, `letters`, `maths`, and `physics`: as you see, i am not making a great effort on finding the perfect ontology of all knowledge; rather, i just use the first broad breakdown of the themes that interest me most at the moment.
|
||||
|
||||
[3][18]
|
||||
|
||||
Just look for the regular expression matching "[[file:" followed by the name of the current file. I find myself seldom needing this apparently very popular functionality, but it should be pretty easy to present the search results in a separate buffer if needed.
|
||||
|
||||
[4][19]
|
||||
|
||||
Another example would be how easy it becomes to incorporate web contents nicely formatted as text when one uses eww as a browser. Or how how seamless it is taking notes on PDFs one's reading in emacs, or even externally zathura (that's for a future blog post though! :)).
|
||||
|
||||
[Tags][20]: [emacs][21]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jao.io/blog/2022-06-19-simple-note-taking.html
|
||||
|
||||
作者:[jao][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://jao.io
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.youtube.com/watch?v=mLzFJcLpDFI
|
||||
[2]: https://jao.io/img/consult-recoll.png
|
||||
[3]: tmp.xKXexbfGmW#fn.1
|
||||
[4]: tmp.xKXexbfGmW#fn.2
|
||||
[5]: https://codeberg.org/jao/consult-recoll
|
||||
[6]: https://codeberg.org/jao/elibs/src/main/lib/doc/jao-org-notes.el
|
||||
[7]: https://codeberg.org/jao/elibs/src/main/lib/doc/jao-org-notes.el#L133
|
||||
[8]: https://codeberg.org/jao/elibs/src/main/lib/doc/jao-org-notes.el#L174
|
||||
[9]: https://codeberg.org/jao/elibs/src/main/lib/doc/jao-org-notes.el#L143
|
||||
[10]: https://codeberg.org/jao/elibs/src/main/lib/doc/jao-org-notes.el#L126
|
||||
[11]: https://jao.io/img/org-notes.png
|
||||
[12]: tmp.xKXexbfGmW#fn.3
|
||||
[13]: https://codeberg.org/jao/elibs/src/main/lib/doc/jao-org-notes.el#L161
|
||||
[14]: https://www.lesbonscomptes.com/recoll/
|
||||
[15]: tmp.xKXexbfGmW#fn.4
|
||||
[16]: tmp.xKXexbfGmW#fnr.1
|
||||
[17]: tmp.xKXexbfGmW#fnr.2
|
||||
[18]: tmp.xKXexbfGmW#fnr.3
|
||||
[19]: tmp.xKXexbfGmW#fnr.4
|
||||
[20]: https://jao.io/blog/tags.html
|
||||
[21]: https://jao.io/blog/tag-emacs.html
|
@ -1,525 +0,0 @@
|
||||
[#]: subject: "Python Microservices Using Flask on Kubernetes"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/09/python-microservices-using-flask-on-kubernetes/"
|
||||
[#]: author: "Krishna Mohan Koyya https://www.opensourceforu.com/author/krishna-mohan-koyya/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Python Microservices Using Flask on Kubernetes
|
||||
======
|
||||
*Microservices follow domain driven design (DDD), irrespective of the platform on which they are developed. Python microservices are not an exception. The object-oriented features of Python 3 make it even easier to model services on the lines of DDD. Part 10 of this series demonstrates how to deploy FindService of user management system as a Python microservice on Kubernetes.*
|
||||
|
||||
The power of microservices architecture lies partly in its polyglot nature. The enterprises decompose their functionality into a set of microservices and each team chooses a platform of its choice.
|
||||
|
||||
Our user management system was already decomposed into four microservices, namely, AddService, FindService, SearchService and JournalService. The AddService was developed on the Java platform and deployed on the Kubernetes cluster for resilience and scalability. This doesn’t mean that the remaining services are also developed on Java. We are free to choose a suitable platform for individual services.
|
||||
|
||||
Let us pick Python as the platform for developing the FindService. The model for FindService has already been designed (refer to the March 2022 issue of Open Source For You). We only need to convert this model into code and configuration.
|
||||
|
||||
### The Pythonic approach
|
||||
|
||||
Python is a general-purpose programming language that has been around for about three decades. In the early days, it was the first choice for automation scripting. However, with frameworks like Django and Flask, its popularity has been growing and it is now adopted in various other domains like enterprise application development. Data science and machine learning pushed the envelope further and Python is now one of the top three programming languages.
|
||||
|
||||
Many people attribute the success of Python to its ease of coding. This is only partially true. As long as your objective is to develop small scripts, Python is just like a toy. You love it. However, the moment you enter the domain of serious large-scale application development, you will have to handle lots of ifs and buts, and Python becomes as good as or as bad as any other platform. For example, take an object-oriented approach! Many Python developers may not even be aware of the fact that Python supports classes, inheritance, etc. Python does support full-blown object-oriented development, but in its own way — the Pythonic way! Let us explore it!
|
||||
|
||||
### The domain model
|
||||
|
||||
AddService adds the users to the system by saving the data into a MySQL database. The objective of the FindService is to offer a REST API to find the users by their name. The domain model is reproduced in Figure 1. It primarily consists of value objects like Name, PhoneNumber along with User entity and UserRepository.
|
||||
|
||||
![Figure 1: The domain model of FindService][1]
|
||||
|
||||
Let us begin with the Name. Since it is a value object, it must be validated by the time it is created and must remain immutable. The basic structure looks like this:
|
||||
|
||||
```
|
||||
class Name:
|
||||
value: str
|
||||
def __post_init__(self):
|
||||
if self.value is None or len(self.value.strip()) < 8 or len(self.value.strip()) > 32:
|
||||
raise ValueError(“Invalid Name”)
|
||||
```
|
||||
|
||||
As you can see, the Name consists of a value attribute of type str. As part of the post initialization, the value is validated.
|
||||
|
||||
Python 3.7 offers @dataclass decorator, which offers many features of a data-carrying class out-of-the-box like constructors, comparison operators, etc.
|
||||
Following is the decorated Name:
|
||||
|
||||
```
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Name:
|
||||
value: str
|
||||
def __post_init__(self):
|
||||
if self.value is None or len(self.value.strip()) < 8 or len(self.value.strip()) > 32:
|
||||
raise ValueError(“Invalid Name”)
|
||||
```
|
||||
|
||||
The following code can create an object Name:
|
||||
|
||||
```
|
||||
name = Name(“Krishna”)
|
||||
```
|
||||
|
||||
The value attribute can be read or written as follows:
|
||||
|
||||
```
|
||||
name.value = “Mohan”
|
||||
print(name.value)
|
||||
```
|
||||
|
||||
Another Name object can be compared as easily as follows:
|
||||
|
||||
```
|
||||
other = Name(“Mohan)
|
||||
if name == other: print(“same”)
|
||||
```
|
||||
|
||||
As you can see, the objects are compared by their values, not by their references. This is all out-of-the-box. We can also make the object immutable, by freezing. Here is the final version of Name as a value object:
|
||||
|
||||
```
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Name:
|
||||
value: str
|
||||
def __post_init__(self):
|
||||
if self.value is None or len(self.value.strip()) < 8 or len(self.value.strip()) > 32:
|
||||
raise ValueError(“Invalid Name”)
|
||||
```
|
||||
|
||||
The PhoneNumber also follows a similar approach, as it is also a value object:
|
||||
|
||||
```
|
||||
@dataclass(frozen=True)
|
||||
class PhoneNumber:
|
||||
value: int
|
||||
def __post_init__(self):
|
||||
if self.value < 9000000000:
|
||||
raise ValueError(“Invalid Phone Number”)
|
||||
```
|
||||
|
||||
The User class is an entity, not a value object. In other words, the User is not immutable. Here is the structure:
|
||||
|
||||
```
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
|
||||
@dataclass
|
||||
class User:
|
||||
_name: Name
|
||||
_phone: PhoneNumber
|
||||
_since: datetime.datetime
|
||||
|
||||
def __post_init__(self):
|
||||
if self._name is None or self._phone is None:
|
||||
raise ValueError(“Invalid user”)
|
||||
if self._since is None:
|
||||
self.since = datetime.datetime.now()
|
||||
```
|
||||
|
||||
You can observe that the User is not frozen as we want it to be mutable. However, we do not want all the properties mutable. The identity field like _name and fields like _since are not expected to be modified. Then, how can this be controlled?
|
||||
|
||||
Python 3 offers the so-called Descriptor protocol. It helps us in defining the getters and setters appropriately. Let us add the getters to all the three fields of User using the @property decorator:
|
||||
|
||||
```
|
||||
@property
|
||||
def name(self) -> Name:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def phone(self) -> PhoneNumber:
|
||||
return self._phone
|
||||
|
||||
@property
|
||||
def since(self) -> datetime.datetime:
|
||||
return self._since
|
||||
```
|
||||
|
||||
And the setter for the phone field can be added using @<field>.setter decoration:
|
||||
|
||||
```
|
||||
@phone.setter
|
||||
def phone(self, phone: PhoneNumber) -> None:
|
||||
if phone is None:
|
||||
raise ValueError(“Invalid phone”)
|
||||
self._phone = phone
|
||||
```
|
||||
|
||||
The User can also be given a method for easy print representation by overriding the __str__() function:
|
||||
|
||||
```
|
||||
def __str__(self):
|
||||
return self.name.value + “ [“ + str(self.phone.value) + “] since “ + str(self.since)
|
||||
```
|
||||
|
||||
With this the entities and the value objects of the domain model are ready. Creating an exception class is as easy as follows:
|
||||
|
||||
```
|
||||
class UserNotFoundException(Exception):
|
||||
pass
|
||||
```
|
||||
|
||||
The only other one remaining in the domain model is the UserRepository. Python offers a useful module called abc for building abstract methods and abstract classes. Since UserRepository is only an interface, we can use the abc package.
|
||||
|
||||
Any Python class that extends abc.ABC becomes abstract. Any function with the @abc.abstractmethod decorator becomes an abstract function. Here is the resultant structure of UserRepository:
|
||||
|
||||
```
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class UserRepository(ABC):
|
||||
@abstractmethod
|
||||
def fetch(self, name:Name) -> User:
|
||||
pass
|
||||
```
|
||||
|
||||
The UserRepository follows the repository pattern. In other words, it offers appropriate CRUD operations on the User entity without exposing the underlying data storage semantics. In our case, we need only fetch() operation since FindService only finds the users.
|
||||
|
||||
Since the UserRepository is an abstract class, we cannot create instance objects from this class. A concrete class must implement this abstract class for object creation.The data layer
|
||||
The UserRepositoryImpl offers the concrete implementation of UserRepository:
|
||||
|
||||
```
|
||||
class UserRepositoryImpl(UserRepository):
|
||||
def fetch(self, name:Name) -> User: pass
|
||||
```
|
||||
|
||||
Since the AddService stores the data of the users in a MySQL database server, the UserRepositoryImpl also must connect to the same database server to retrieve the data. The code for connecting to the database is given below. Observe that we are using the connector library of MySQL.
|
||||
|
||||
```
|
||||
from mysql.connector import connect, Error
|
||||
```
|
||||
|
||||
```
|
||||
class UserRepositoryImpl(UserRepository):
|
||||
def fetch(self, name:Name) -> User:
|
||||
try:
|
||||
with connect(
|
||||
host=”mysqldb”,
|
||||
user=”root”,
|
||||
password=”admin”,
|
||||
database=”glarimy”,
|
||||
) as connection:
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute(“SELECT * FROM ums_users where name=%s”, (name.value,))
|
||||
row = cursor.fetchone()
|
||||
if cursor.rowcount == -1:
|
||||
raise UserNotFoundException()
|
||||
else:
|
||||
return User(Name(row[0]), PhoneNumber(row[1]), row[2])
|
||||
except Error as e:
|
||||
raise e
|
||||
```
|
||||
|
||||
In the above snippet, we are connecting to a database server named mysqldb using root as the user and admin as the password, in order to use the database schema named glarimy. It is fine to have such information in the code for an illustration, but surely not a suggested approach in production as it exposes sensitive information.
|
||||
|
||||
The logic of the fetch() operation is quite intuitive. It executes a SELECT query against the ums_users table. Recollect that the AddService was writing the user data into the same table. In case the SELECT query returns no records, the fetch() function throws UserNotFoundException. Otherwise, it constructs the User entity from the record and returns it to the caller. Nothing unusual.
|
||||
|
||||
### The application layer
|
||||
|
||||
And finally, we need to build the application layer. The model is reproduced in Figure 2. It consists of just two classes: a controller and a DTO.
|
||||
|
||||
![Figure 2: The application layer of FindService][2]
|
||||
|
||||
As we already know, a DTO is just a data container without any business logic. It is primarily used for carrying data between the FindService and the outside world. We just offer a way to convert the UserRecord into a dictionary for JSON marshalling in the REST layer:
|
||||
|
||||
```
|
||||
class UserRecord:
|
||||
def toJSON(self):
|
||||
return {
|
||||
“name”: self.name,
|
||||
“phone”: self.phone,
|
||||
“since”: self.since
|
||||
}
|
||||
```
|
||||
|
||||
The job of a controller is to convert DTOs to domain objects for invoking the domain services and vice versa, as can be observed in the find() operation.
|
||||
|
||||
```
|
||||
class UserController:
|
||||
|
||||
def __init__(self):
|
||||
self._repo = UserRepositoryImpl()
|
||||
|
||||
def find(self, name: str):
|
||||
try:
|
||||
user: User = self._repo.fetch(Name(name))
|
||||
record: UserRecord = UserRecord()
|
||||
record.name = user.name.value
|
||||
record.phone = user.phone.value
|
||||
record.since = user.since
|
||||
return record
|
||||
except UserNotFoundException as e:
|
||||
return None
|
||||
```
|
||||
|
||||
The find() operation receives a string as a name, converts it as a Name object and invokes the UserRepository to fetch the corresponding User object. If it is found, a UserRecord is created by using the retrieved User object. Recollect that it is necessary to convert the domain objects as DTO to hide the domain model from the external world.
|
||||
|
||||
The UserController need not have multiple instances. It can be a singleton as well. By overriding the __new__ operation, it can be modelled as a singleton:
|
||||
|
||||
```
|
||||
class UserController:
|
||||
def __new__(self):
|
||||
if not hasattr(self, ‘instance’):
|
||||
self.instance = super().__new__(self)
|
||||
return self.instance
|
||||
|
||||
def __init__(self):
|
||||
self._repo = UserRepositoryImpl()
|
||||
|
||||
def find(self, name: str):
|
||||
try:
|
||||
user: User = self._repo.fetch(Name(name))
|
||||
record: UserRecord = UserRecord()
|
||||
record.name = user.name.getValue()
|
||||
record.phone = user.phone.getValue()
|
||||
record.since = user.since
|
||||
return record
|
||||
except UserNotFoundException as e:
|
||||
return None
|
||||
```
|
||||
|
||||
We are done with implementing the model of the FindService fully. The only task remaining is to expose it as a REST service.
|
||||
|
||||
### The REST API
|
||||
|
||||
Our FindService offers only one API and that is to find a user by name. The obvious URI is as follows:
|
||||
|
||||
```
|
||||
GET /user/{name}
|
||||
```
|
||||
|
||||
This API is expected to find the user with the supplied name and returns the details of phone number, etc, of the user in JSON format. In case no such user is found, the API is expected to return a 404 status.
|
||||
|
||||
We can use the Flask framework to build the REST API. This framework was originally built for developing Web applications using Python. It is further extended to support the REST views besides the HTML views. We pick this framework for its simplicity.
|
||||
Start by creating a Flask application:
|
||||
|
||||
```
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
```
|
||||
|
||||
Then define the routes for the Flask application as simple functions:
|
||||
|
||||
```
|
||||
@app.route(‘/user/<name>’)
|
||||
def get(name): pass
|
||||
```
|
||||
|
||||
Observe that the @app.route is mapped to the API /user/<name> on one side and to the function get() on the other side.
|
||||
|
||||
As you may already have figured out, this get() function will be invoked every time the user accesses the API with a URI like http://server:port/user/Krishna. Flask is intelligent enough to extract ‘Krishna’ as the name from the URI and pass it to the get() function.
|
||||
|
||||
The get() function is straightforward. It asks the controller to find the user and returns the same after marshalling it to the JSON format along with the usual HTTP headers. In case the controller returns None, the get() function returns the response with an appropriate HTTP status.
|
||||
|
||||
```
|
||||
from flask import jsonify, abort
|
||||
|
||||
controller = UserController()
|
||||
record = controller.find(name)
|
||||
if record is None:
|
||||
abort(404)
|
||||
else:
|
||||
resp = jsonify(record.toJSON())
|
||||
resp.status_code = 200
|
||||
return resp
|
||||
```
|
||||
|
||||
And, finally, the Flask app needs to be served. We can use the waitress server for this purpose.
|
||||
|
||||
```
|
||||
from waitress import serve
|
||||
serve(app, host=”0.0.0.0”, port=8080)
|
||||
```
|
||||
|
||||
In the above snippet, the app is served on port 8080 on the local host.
|
||||
The final code looks like this:
|
||||
|
||||
```
|
||||
from flask import Flask, jsonify, abort
|
||||
from waitress import serve
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route(‘/user/<name>’)
|
||||
def get(name):
|
||||
controller = UserController()
|
||||
record = controller.find(name)
|
||||
if record is None:
|
||||
abort(404)
|
||||
else:
|
||||
resp = jsonify(record.toJSON())
|
||||
resp.status_code = 200
|
||||
return resp
|
||||
|
||||
serve(app, host=”0.0.0.0”, port=8080)
|
||||
```
|
||||
|
||||
### Deployment
|
||||
|
||||
The FindService is now ready with code. It has its domain model, data layer, and application layer besides the REST API. The next step is to build the service, containerise it, and then deploy it on Kubernetes. The process is in no way different from any other service, though there are some Python-specific steps.
|
||||
|
||||
Before proceeding further, let us have a look at the folder/file structure:
|
||||
|
||||
```
|
||||
+ ums-find-service
|
||||
+ ums
|
||||
- domain.py
|
||||
- data.py
|
||||
- app.py
|
||||
- Dockerfile
|
||||
- requirements.txt
|
||||
- kube-find-deployment.yml
|
||||
```
|
||||
|
||||
As you can observe, the whole work is under the ums-find-service folder. It contains the code in the ums folder and configurations in Dockerfile, requirements.txt and kube-find-deployment.yml files.
|
||||
|
||||
The domain.py consists of the domain model classes, data.py consists of UserRepositoryImpl and app.py consists of the rest of the code. Since we have seen the code already, let us move on to the configuration files.
|
||||
|
||||
The first one is the file named requirements.txt. It declares the external dependencies for the Python system to download and install. We need to populate it with every external Python module that we use in the FindService. As you know, we used MySQL connector, Flask and Waitress modules. Hence the following is the content of the requirements.txt.
|
||||
|
||||
```
|
||||
Flask==2.1.1
|
||||
Flask_RESTful
|
||||
mysql-connector-python
|
||||
waitress
|
||||
```
|
||||
|
||||
The second step is to declare the manifestation for dockerisation in Dockerfile. Here it is:
|
||||
|
||||
```
|
||||
FROM python:3.8-slim-buster
|
||||
|
||||
WORKDIR /ums
|
||||
ADD ums /ums
|
||||
ADD requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT [“python”]
|
||||
CMD [“/ums/app.py”]
|
||||
```
|
||||
|
||||
In summary, we used Python 3.8 as the baseline and moved our code from the ums folder to a corresponding folder in the Docker container, besides moving the requirements.txt. Then we instructed the container to run the pip3 install command. And, finally, we exposed port 8080 (since the waitress was running on that port).
|
||||
|
||||
In order to run the service, we instructed the container to use the following command:
|
||||
|
||||
```
|
||||
python /ums/app.py
|
||||
```
|
||||
|
||||
Once the Dockerfile is ready, run the following command from within the ums-find-service folder to create the Dockerised image:
|
||||
|
||||
```
|
||||
docker build -t glarimy/ums-find-service
|
||||
```
|
||||
|
||||
It creates the Docker image, which can be found using the following command:
|
||||
|
||||
```
|
||||
docker images
|
||||
```
|
||||
|
||||
Try pushing the image to the Docker Hub as appropriate. You may log in to Docker as well.
|
||||
|
||||
```
|
||||
docker login
|
||||
docker push glarimy/ums-find-service
|
||||
```
|
||||
|
||||
And the last step is to build the manifest for the Kubernetes deployment.
|
||||
|
||||
We have already covered the way to set up the Kubernetes cluster, and deploy and use services, in the previous part. I am assuming that we still have the manifest file we used in the previous part for deploying the AddService, MySQL, Kafka and Zookeeper. We only need to add the following entries into the kube-find-deployment.yml file:
|
||||
|
||||
```
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ums-find-service
|
||||
labels:
|
||||
app: ums-find-service
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ums-find-service
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ums-find-service
|
||||
spec:
|
||||
containers:
|
||||
- name: ums-find-service
|
||||
image: glarimy/ums-find-service
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ums-find-service
|
||||
labels:
|
||||
name: ums-find-service
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 8080
|
||||
selector:
|
||||
app: ums-find-service
|
||||
```
|
||||
|
||||
The first part of the above manifest declares a deployment of FindService from the image glarimy/ums-find-service with three replicas. It also exposes port 8080. And the latter part of the manifest declares a Kubernetes service as the front-end for the FindService deployment. Recollect that the MySQL service in the name of mysqldb was already part of the above manifest from the previous part.
|
||||
|
||||
Run the following command to deploy the manifest on a Kubernetes cluster:
|
||||
|
||||
```
|
||||
kubectl create -f kube-find-deployment.yml
|
||||
```
|
||||
|
||||
Once the deployment is finished, you can verify the pods and services using the following command:
|
||||
|
||||
```
|
||||
kubectl get services
|
||||
```
|
||||
|
||||
It gives an output as shown in Figure 3.
|
||||
|
||||
![Figure 3: Kubernetes services][3]
|
||||
|
||||
It lists all the services running on the cluster. Make a note of the external-ip of the FindService and use the curl command to invoke the service:
|
||||
|
||||
```
|
||||
curl http://10.98.45.187:8080/user/KrishnaMohan
|
||||
```
|
||||
|
||||
Note that the IP address 10.98.45.187 corresponds to the FindService, as found in Figure 3.
|
||||
|
||||
If we have used the AddService to create a user by the name KrishnaMohan, the above curl command looks like what is shown in Figure 4.
|
||||
|
||||
![Figure 4: FindService][4]
|
||||
|
||||
With the AddService and FindService, along with the required back-end services for storage and messaging, the architecture of the user management system (UMS) stands as shown in Figure 5, at this point. You can observe that the end-user uses the IP address of the ums-add-service for adding a new user, whereas it uses the IP address of the ums-find-service for finding existing users. Each of these Kubernetes services are backed by three pods with the corresponding containers. Also note that the same mysqldb service is used for storing and retrieving the user data.
|
||||
|
||||
![Figure 5: UMS with AddService and FindService][5]
|
||||
|
||||
### What about the other services?
|
||||
|
||||
The UMS consists of two more services, namely, SearchService and JournalService. We will design these services in the next part of this series on the Node platform, and deploy them on the same Kubernetes cluster to demonstrate the real power of polyglot microservices architecture. We will conclude by observing some design patterns pertaining to microservices.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/09/python-microservices-using-flask-on-kubernetes/
|
||||
|
||||
作者:[Krishna Mohan Koyya][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/krishna-mohan-koyya/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-1-The-domain-model-of-FindService-1.png
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-2-The-application-layer-of-FindService.png
|
||||
[3]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-3-Kubernetes-services-1.png
|
||||
[4]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-4-FindService.png
|
||||
[5]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-5-UMS-with-AddService-and-FindService.png
|
@ -1,323 +0,0 @@
|
||||
[#]: subject: "How To Find Default Gateway IP Address In Linux And Unix From Commandline"
|
||||
[#]: via: "https://ostechnix.com/find-default-gateway-linux/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How To Find Default Gateway IP Address In Linux And Unix From Commandline
|
||||
======
|
||||
5 Ways To Find Gateway Or Router IP Address In Linux
|
||||
|
||||
A **gateway** is a node or a router that allows two or more hosts with different IP addresses to communicate with each other when connected to the same router. Without gateway, devices connected on the same router won’t be able to communicate with each other. To put this another way, the gateway acts as an access point to pass network data from a local network to a remote network. In this guide, we will see all the possible ways to **find default gateway in Linux** and **Unix** from commandline.
|
||||
|
||||
#### Contents
|
||||
|
||||
1. Find Default Gateway In Linux 2. 1. Find Default Gateway Using ip Command 3. 2. Display Default Gateway IP Address Using route Command 4. 3. View Gateway IP Address Using netstat Command 5. 4. Print Default Gateway IP Address Or Router IP Address Using routel Command 6. 5. Find Gateway From Ethernet Configuration Files
|
||||
7. Conclusion
|
||||
|
||||
### Find Default Gateway In Linux
|
||||
|
||||
There are various commandline tools are available to view the gateway IP address in Linux. The most commonly used tools are: **ip**, **ss**, and **netcat**. We will see how check the default gateway using each tool with examples.
|
||||
|
||||
#### 1. Find Default Gateway Using ip Command
|
||||
|
||||
The **ip** command is used to show and manipulate routing, network devices, interfaces and tunnels in Linux.
|
||||
|
||||
To find the default gateway or Router IP address, simply run:
|
||||
|
||||
```
|
||||
$ ip route
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
$ ip r
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
$ ip route show
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
default via 192.168.1.101 dev eth0 proto static metric 100
|
||||
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
|
||||
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.20 metric 100
|
||||
```
|
||||
|
||||
Did you see the line **"default via 192.168.1.101"** in the above output? This is the default gateway. So my default gateway is **192.168.1.101**.
|
||||
|
||||
You can use **-4** with `ip route` command to **display the IPv4 gateway** only:
|
||||
|
||||
```
|
||||
$ ip -4 route
|
||||
```
|
||||
|
||||
And, use `-6` to **display the IPv6 gateway** only:
|
||||
|
||||
```
|
||||
$ ip -6 route
|
||||
```
|
||||
|
||||
As you noticed in the output, the IP address and the subnet details are also shown. If you want to display ONLY the default gateway and exclude all other details from the output, you can use `awk` command with `ip route` like below.
|
||||
|
||||
To find the default gateway IP address using `ip route` and `grep`, run:
|
||||
|
||||
To print Gateway IP address with `ip route` and `awk` commands, run:
|
||||
|
||||
```
|
||||
$ ip route | awk '/^default/{print $3}'
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
$ ip route show default | awk '{print $3}'
|
||||
```
|
||||
|
||||
This will list only the gateway.
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
192.168.1.101
|
||||
```
|
||||
|
||||
![Find Default Gateway Using ip Command][1]
|
||||
|
||||
You can also use **[grep][2]** command with `ip route` to filter the default gateway.
|
||||
|
||||
```
|
||||
$ ip route | grep default
|
||||
default via 192.168.1.101 dev eth0 proto static metric 100
|
||||
```
|
||||
|
||||
The `ip route` is the recommended command to find the default gateway IP address in latest Linux distributions. However, some of you may still be using the legacy tools like **route** and `netstat`. Old habits die hard, right? The following sections explains how to determine the gateway in Linux using `route` and `netstat` commands.
|
||||
|
||||
#### 2. Display Default Gateway IP Address Using route Command
|
||||
|
||||
The **route** command is used to show and manipulate routing table in older Linux distributions, for example RHEL 6, CentOS 6.
|
||||
|
||||
If you're using those older Linux distributions, you can use the `route` command to display the default gateway.
|
||||
|
||||
Please note that the `route` tool is deprecated and replaced with `ip route` command in the latest Linux distributions. If you still want to use `route` for any reason, you need to install it.
|
||||
|
||||
First, we need to check which package provides `route` command. To do so, run the following command on your RHEL-based system:
|
||||
|
||||
```
|
||||
$ dnf provides route
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
net-tools-2.0-0.52.20160912git.el8.x86_64 : Basic networking tools
|
||||
Repo : @System
|
||||
Matched from:
|
||||
Filename : /usr/sbin/route
|
||||
|
||||
net-tools-2.0-0.52.20160912git.el8.x86_64 : Basic networking tools
|
||||
Repo : baseos
|
||||
Matched from:
|
||||
Filename : /usr/sbin/route
|
||||
```
|
||||
|
||||
As you can see in the above output, the net-tools package provides the `route` command. So, let us install it using command:
|
||||
|
||||
```
|
||||
$ sudo dnf install net-tools
|
||||
```
|
||||
|
||||
Now, run `route` command with `-n` flag to display the gateway IP address or router IP address in your Linux system:
|
||||
|
||||
```
|
||||
$ route -n
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
Kernel IP routing table
|
||||
Destination Gateway Genmask Flags Metric Ref Use Iface
|
||||
0.0.0.0 192.168.1.101 0.0.0.0 UG 100 0 0 eth0
|
||||
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
|
||||
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
|
||||
```
|
||||
|
||||
![Display Default Gateway IP Address Using route Command][3]
|
||||
|
||||
As you see in the above output, the gateway IP address is 192.168.1.101. You will also see the two letters **"UG"** under Flags section. The letter **"U"** indicates the interface is **UP** and **G** stands for Gateway.
|
||||
|
||||
#### 3. View Gateway IP Address Using netstat Command
|
||||
|
||||
**Netstat** prints information about the Linux networking subsystem. Using netstat tool, we can print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships in Linux and Unix systems.
|
||||
|
||||
Netstat is part of net-tools package, so make sure you've installed it in your Linux system. The following commands install net-tools package in RHEL-based systems:
|
||||
|
||||
```
|
||||
$ sudo dnf install net-tools
|
||||
```
|
||||
|
||||
To print the default gateway IP address using `netstat` command, run:
|
||||
|
||||
```
|
||||
$ netstat -rn
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
Kernel IP routing table
|
||||
Destination Gateway Genmask Flags MSS Window irtt Iface
|
||||
0.0.0.0 192.168.1.101 0.0.0.0 UG 0 0 0 eth0
|
||||
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
|
||||
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
|
||||
```
|
||||
|
||||
![View Gateway IP Address Using netstat Command][4]
|
||||
|
||||
The `netstat` command's output is same as `route` command's output. As per the above output, the gateway IP address is 192.168.1.101 and the UG stands the NIC associated to gateway is UP and G indicates Gateway,
|
||||
|
||||
Please note that `netstat` is also deprecated and it is recommended to use **"ss"** command instead of netstat.
|
||||
|
||||
#### 4. Print Default Gateway IP Address Or Router IP Address Using routel Command
|
||||
|
||||
The **routel** is a script to list routes with pretty output format. The routel script will list routes in a format that some might consider easier to interpret then the `ip route` list equivalent.
|
||||
|
||||
The routel script is also the part of net-tools package.
|
||||
|
||||
To print the default gateway or router IP address, run routel script without any flags like below:
|
||||
|
||||
```
|
||||
$ routel
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
target gateway source proto scope dev tbl
|
||||
default 192.168.1.101 static eth0
|
||||
172.17.0.0/ 16 172.17.0.1 kernel linkdocker0
|
||||
192.168.1.0/ 24 192.168.1.20 kernel link eth0
|
||||
127.0.0.0/ 8 local 127.0.0.1 kernel host lo local
|
||||
127.0.0.1 local 127.0.0.1 kernel host lo local
|
||||
127.255.255.255 broadcast 127.0.0.1 kernel link lo local
|
||||
172.17.0.1 local 172.17.0.1 kernel hostdocker0 local
|
||||
172.17.255.255 broadcast 172.17.0.1 kernel linkdocker0 local
|
||||
192.168.1.20 local 192.168.1.20 kernel host eth0 local
|
||||
192.168.1.255 broadcast 192.168.1.20 kernel link eth0 local
|
||||
::1 kernel lo
|
||||
::/ 96 unreachable lo
|
||||
::ffff:0.0.0.0/ 96 unreachable lo
|
||||
2002:a00::/ 24 unreachable lo
|
||||
2002:7f00::/ 24 unreachable lo
|
||||
2002:a9fe::/ 32 unreachable lo
|
||||
2002:ac10::/ 28 unreachable lo
|
||||
2002:c0a8::/ 32 unreachable lo
|
||||
2002:e000::/ 19 unreachable lo
|
||||
3ffe:ffff::/ 32 unreachable lo
|
||||
fe80::/ 64 kernel eth0
|
||||
::1 local kernel lo local
|
||||
fe80::d085:cff:fec7:c1c3 local kernel eth0 local
|
||||
```
|
||||
|
||||
![Print Default Gateway IP Address Or Router IP Address Using routel Command][5]
|
||||
|
||||
To print only the default gateway, run routel with `grep` like below:
|
||||
|
||||
```
|
||||
$ routel | grep default
|
||||
default 192.168.1.101 static eth0
|
||||
```
|
||||
|
||||
#### 5. Find Gateway From Ethernet Configuration Files
|
||||
|
||||
If you have **[configured static IP address in your Linux or Unix][6]** system, you can view the default gateway or router IP address by looking at the network configuration files.
|
||||
|
||||
In RPM-based systems like Fedora, RHEL, CentOS, AlmaLinux and Rocky Linux, the network interface card (shortly **NIC**) configuration are stored under **/etc/sysconfig/network-scripts/** directory.
|
||||
|
||||
Find the name of the network card:
|
||||
|
||||
```
|
||||
# ip link show
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
2: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
|
||||
link/ether d2:85:0c:c7:c1:c3 brd ff:ff:ff:ff:ff:ff link-netnsid 0
|
||||
```
|
||||
|
||||
The network card name is **eth0**. So let us open the network card configuration of this NIC card file:
|
||||
|
||||
```
|
||||
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
DEVICE=eth0
|
||||
ONBOOT=yes
|
||||
UUID=eb6b6a7c-37f5-11ed-a59a-a0e70bdf3dfb
|
||||
BOOTPROTO=none
|
||||
IPADDR=192.168.1.20
|
||||
NETMASK=255.255.255.0
|
||||
GATEWAY=192.168.1.101
|
||||
DNS1=8.8.8.8
|
||||
```
|
||||
|
||||
As you see above, the gateway IP is `192.168.1.101`.
|
||||
|
||||
In Debian, Ubuntu and its derivatives, all network configuration files are stored under **/etc/network/** directory.
|
||||
|
||||
```
|
||||
$ cat /etc/network/interfaces
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
auto ens18
|
||||
iface ens18 inet static
|
||||
address 192.168.1.150
|
||||
netmask 255.255.255.0
|
||||
gateway 192.168.1.101
|
||||
dns-nameservers 8.8.8.8
|
||||
```
|
||||
|
||||
Please note that this method should work only if the IP address is configured manually. For DHCP-enabled network, you need to follow the previous 4 methods.
|
||||
|
||||
### Conclusion
|
||||
|
||||
In this guide, we listed 5 different ways to find default gateway in Linux and Unix operating systems. We also have included sample commands to display the gateway/router IP address in each method. Hope this helps.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/find-default-gateway-linux/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/wp-content/uploads/2022/09/Find-Default-Gateway-Using-ip-Command.png
|
||||
[2]: https://ostechnix.com/the-grep-command-tutorial-with-examples-for-beginners/
|
||||
[3]: https://ostechnix.com/wp-content/uploads/2022/09/Display-Default-Gateway-IP-Address-Using-route-Command.png
|
||||
[4]: https://ostechnix.com/wp-content/uploads/2022/09/View-Gateway-IP-Address-Using-netstat-Command.png
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/09/Print-Default-Gateway-IP-Address-Or-Router-IP-Address-Using-routel-Command.png
|
||||
[6]: https://ostechnix.com/configure-static-ip-address-linux-unix/
|
@ -1,185 +0,0 @@
|
||||
[#]: subject: "PyLint: The good, the bad, and the ugly"
|
||||
[#]: via: "https://opensource.com/article/22/9/pylint-good-bad-ugly"
|
||||
[#]: author: "Moshe Zadka https://opensource.com/users/moshez"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
PyLint: The good, the bad, and the ugly
|
||||
======
|
||||
Get the most out of PyLint.
|
||||
|
||||
![Python programming language logo with question marks][1]
|
||||
|
||||
Image by: Opensource.com
|
||||
|
||||
Hot take: PyLint is actually good!
|
||||
|
||||
"PyLint can save your life" is an exaggeration, but not as much as you might think! PyLint can keep you from really really hard to find and complicated bugs. At worst, it can save you the time of a test run. At best, it can help you avoid complicated production mistakes.
|
||||
|
||||
### The good
|
||||
|
||||
I'm embarrassed to say how common this can be. Naming tests is perpetually *weird*: Nothing cares about the name, and there's often not a natural name to be found. For instance, look at this code:
|
||||
|
||||
```
|
||||
def test_add_small():
|
||||
# Math, am I right?
|
||||
assert 1 + 1 == 3
|
||||
|
||||
def test_add_large():
|
||||
assert 5 + 6 == 11
|
||||
|
||||
def test_add_small():
|
||||
assert 1 + 10 == 11
|
||||
```
|
||||
|
||||
The test works:
|
||||
|
||||
```
|
||||
collected 2 items
|
||||
test.py ..
|
||||
2 passed
|
||||
```
|
||||
|
||||
In reality, these files can be hundreds of lines long, and the person adding the new test might not be aware of all the names. Unless someone is looking at test output carefully, everything looks fine.
|
||||
|
||||
Worst of all, the *addition of the overriding test*, the *breakage of the overridden test*, and the *problem that results in prod* might be separated by days, months, or even years.
|
||||
|
||||
### PyLint finds it
|
||||
|
||||
But like a good friend, PyLint is there for you.
|
||||
|
||||
```
|
||||
test.py:8:0: E0102: function already defined line 1
|
||||
(function-redefined)
|
||||
```
|
||||
|
||||
### The bad
|
||||
|
||||
Like a 90s sitcom, the more you get into PyLint, the more it becomes problematic. This is completely reasonable code for an inventory modeling program:
|
||||
|
||||
```
|
||||
"""Inventory abstractions"""
|
||||
|
||||
import attrs
|
||||
|
||||
@attrs.define
|
||||
class Laptop:
|
||||
"""A laptop"""
|
||||
ident: str
|
||||
cpu: str
|
||||
```
|
||||
|
||||
It seems that PyLint has opinions (probably formed in the 90s) and is not afraid to state them as facts:
|
||||
|
||||
```
|
||||
$ pylint laptop.py | sed -n '/^laptop/s/[^ ]*: //p'
|
||||
R0903: Too few public methods (0/2) (too-few-public-methods)
|
||||
```
|
||||
|
||||
### The ugly
|
||||
|
||||
Ever wanted to add your own unvetted opinion to a tool used by millions? PyLint has 12 million monthly downloads.
|
||||
|
||||
> "People will just disable the whole check if it's too picky." —PyLint issue 6987, July 3rd, 2022
|
||||
|
||||
The attitude it takes towards adding a test with potentially many false positives is...*"eh."*
|
||||
|
||||
### Making it work for you
|
||||
|
||||
PyLint is fine, but you need to interact with it carefully. Here are the three things I recommend to make PyLint work for you.
|
||||
|
||||
#### 1. Pin it
|
||||
|
||||
Pin the PyLint version you use to avoid any surprises!
|
||||
|
||||
In your `.toml` file:
|
||||
|
||||
```
|
||||
[project.optional-dependencies]
|
||||
pylint = ["pylint"]
|
||||
```
|
||||
|
||||
In your code:
|
||||
|
||||
```
|
||||
from unittest import mock
|
||||
```
|
||||
|
||||
This corresponds with code like this:
|
||||
|
||||
```
|
||||
# noxfile.py
|
||||
...
|
||||
@nox.session(python=VERSIONS[-1])
|
||||
def refresh_deps(session):
|
||||
"""Refresh the requirements-*.txt files"""
|
||||
session.install("pip-tools")
|
||||
for deps in [..., "pylint"]:
|
||||
session.run(
|
||||
"pip-compile",
|
||||
"--extra",
|
||||
deps,
|
||||
"pyproject.toml",
|
||||
"--output-file",
|
||||
f"requirements-{deps}.txt",
|
||||
)
|
||||
```
|
||||
|
||||
#### 2. Default deny
|
||||
|
||||
Disable all checks. Then enable ones that you think have a high value-to-false-positive ratio. (Not just false-negative-to-false-positive ratio!)
|
||||
|
||||
```
|
||||
# noxfile.py
|
||||
...
|
||||
@nox.session(python="3.10")
|
||||
def lint(session):
|
||||
files = ["src/", "noxfile.py"]
|
||||
session.install("-r", "requirements-pylint.txt")
|
||||
session.install("-e", ".")
|
||||
session.run(
|
||||
"pylint",
|
||||
"--disable=all",
|
||||
*(f"--enable={checker}" for checker in checkers)
|
||||
"src",
|
||||
)
|
||||
```
|
||||
|
||||
#### 3. Checkers
|
||||
|
||||
These are some of the ones I like. Enforce consistency in the project, avoid some obvious mistakes.
|
||||
|
||||
```
|
||||
checkers = [
|
||||
"missing-class-docstring",
|
||||
"missing-function-docstring",
|
||||
"missing-module-docstring",
|
||||
"function-redefined",
|
||||
]
|
||||
```
|
||||
|
||||
### Using PyLint
|
||||
|
||||
You can take just the good parts of PyLint. Run it in CI to keep consistency, and use the highest value checkers.
|
||||
|
||||
Lose the bad parts: Default deny checkers.
|
||||
|
||||
Avoid the ugly parts: Pin the version to avoid surprises.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/pylint-good-bad-ugly
|
||||
|
||||
作者:[Moshe Zadka][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/moshez
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/python_programming_question.png
|
@ -1,206 +0,0 @@
|
||||
[#]: subject: "GUI Apps for Package Management in Arch Linux"
|
||||
[#]: via: "https://itsfoss.com/arch-linux-gui-package-managers/"
|
||||
[#]: author: "Anuj Sharma https://itsfoss.com/author/anuj/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
GUI Apps for Package Management in Arch Linux
|
||||
======
|
||||
|
||||
[Installing Arch Linux][1] is considered challenging. This is why [several Arch-based distributions exist][2] to make things easier by providing a graphical installer.
|
||||
|
||||
Even if you manage to install Arch Linux, you’ll notice that it relies heavily on the command line. You’ll have to open the terminal if you have to install applications or update the system.
|
||||
|
||||
Yes! Arch Linux does not have a software center. Shocking for many, I know.
|
||||
|
||||
If you feel uncomfortable using the command line for managing applications, you can install a GUI tool. This helps in searching for packages and installing and removing them from the comfort of the GUI.
|
||||
|
||||
Wondering which graphical frontend for [pacman commands][3] you should use? I have some suggestions to help you get started.
|
||||
|
||||
**Please note that some software managers are desktop environment specific.**
|
||||
|
||||
### 1. Apper
|
||||
|
||||
![Installing Firefox using Apper][4]
|
||||
|
||||
Apper is a minimal Qt5 application and package manager using PackageKit which also supports AppStream and automatic updates. But, **there is no AUR support**.
|
||||
|
||||
To install it from the official repos use the command below.
|
||||
|
||||
```
|
||||
sudo pacman -Syu apper
|
||||
```
|
||||
|
||||
[Apper on GitLab][5]
|
||||
|
||||
### 2. Deepin App Store
|
||||
|
||||
![Installing Firefox using Deepin App Store][6]
|
||||
|
||||
Deepin App Store is an app store for Deepin Desktop Environment built with DTK(Qt5), using PackageKit with AppStream support and also provides system update notifications. There is **no AUR support**.
|
||||
|
||||
To install it, use the command below.
|
||||
|
||||
```
|
||||
sudo pacman -Syu deepin-store
|
||||
```
|
||||
|
||||
[Deepin Store on Github][7]
|
||||
|
||||
### 3. Discover
|
||||
|
||||
![Installing Firefox using Discover][8]
|
||||
|
||||
Discover needs no introduction for KDE Plasma users. It is a Qt-based application manager using PackageKit which supports AppStream, Flatpak and Firmware updates.
|
||||
|
||||
For installing Flatpak and Firmware updates from Discover `flatpak` and `fwupd` packages need to be installed respectively.
|
||||
|
||||
There is no AUR support.
|
||||
|
||||
```
|
||||
sudo pacman -Syu discover packagekit-qt5
|
||||
```
|
||||
|
||||
[Discover on GitLab][9]
|
||||
|
||||
### 4. GNOME PackageKit
|
||||
|
||||
![Installing Firefox using GNOME PackageKit][10]
|
||||
|
||||
GNOMEPackageKit is a GTK3 package manager using PackageKit which supports AppStream. Unfortunately, there is **no AUR support**.
|
||||
|
||||
To install it from the official repos use the command below.
|
||||
|
||||
```
|
||||
sudo pacman -Syu gnome-packagekit
|
||||
```
|
||||
|
||||
[PackageKit on freedesktop][11]
|
||||
|
||||
### 5. GNOME Software
|
||||
|
||||
![Installing Firefox using GNOME Software][12]
|
||||
|
||||
GNOME Software needs no introduction for GNOME desktop users. It is the GTK4 application manager using PackageKit which supports AppStream, Flatpak and Firmware updates.
|
||||
|
||||
There is no AUR support. To install Flatpak and Firmware updates from GNOME Software `flatpak` and `fwupd` packages need to be installed respectively.
|
||||
|
||||
Install it using:
|
||||
|
||||
```
|
||||
sudo pacman -Syu gnome-software-packagekit-plugin gnome-software
|
||||
```
|
||||
|
||||
[GNOME Software on GitLab][13]
|
||||
|
||||
### 6. tkPacman
|
||||
|
||||
![Installing Firefox using tkPacman][14]
|
||||
|
||||
It is a Tk pacman wrapper written in Tcl. The interface is similar to [Synaptic Package Manager][15].
|
||||
|
||||
It is quite lightweight due to no GTK/Qt dependencies as it is uses Tcl/Tk GUI toolkit.
|
||||
|
||||
It does not support AUR which is ironic because you need to install it from [AUR][16]. You need to install an [AUR helper][17] like yay beforehand.
|
||||
|
||||
```
|
||||
yay -Syu tkpacman
|
||||
```
|
||||
|
||||
[tkPacman on Sourceforge][18]
|
||||
|
||||
### 7. Octopi
|
||||
|
||||
![Installing Firefox using Octopi][19]
|
||||
|
||||
Consider it a better looking cousin of tkPacman. It uses Qt5 and Alpm and also supports Appstream and **AUR (via yay)**.
|
||||
|
||||
You also get desktop notifications, repository editor and cache cleaner. The interface is similar to Synaptic Package Manager.
|
||||
|
||||
To install it from the AUR, use the following command.
|
||||
|
||||
```
|
||||
yay -Syu octopi
|
||||
```
|
||||
|
||||
[Octopi on GitHub][20]
|
||||
|
||||
### 8. Pamac
|
||||
|
||||
![Installing Firefox using Pamac][21]
|
||||
|
||||
Pamac is the graphical package manager from Manjaro Linux. It based on GTK3 and Alpm and **supports AUR, Appstream, Flatpak and Snap**.
|
||||
|
||||
Pamac also supports automatic download of updates and downgrade of packages.
|
||||
|
||||
It is the most widely used Application in Arch Linux derivatives. But, has been notorious for [DDoSing the AUR webpage][22].
|
||||
|
||||
There are several ways to [install Pamac on Arch Linux][23]. The simplest would be to use an AUR helper.
|
||||
|
||||
```
|
||||
yay -Syu pamac-aur
|
||||
```
|
||||
|
||||
[Pamac on GitLab][24]
|
||||
|
||||
### Conclusion
|
||||
|
||||
To remove any of the above-mentioned GUI package managers along with the dependencies and configuration files, use the following command replacing *packagename* with the name of package to be removed.
|
||||
|
||||
```
|
||||
sudo pacman -Rns packagename
|
||||
```
|
||||
|
||||
So it seems Arch Linux can also be used without touching the terminal with the right tools.
|
||||
|
||||
There are also some other applications also which use Terminal User Interface (TUI). A few examples are [pcurses][25], [cylon][26], [pacseek][27], and [yup][28]. But, this article is about only the ones with proper GUI.
|
||||
|
||||
**Note:** PackageKit opens up system permissions by default, and is otherwise [not recommended][29] for general usage. Because if the user is part of the wheel group no password is required to update or install any software.
|
||||
|
||||
**You saw several options for using GUI software center on Arch Linux. It’s time to make a decision on using one of them. Which one would you choose? Pamac or OctoPi or something else? Leave a quick comment below right now.**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/arch-linux-gui-package-managers/
|
||||
|
||||
作者:[Anuj 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/anuj/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/install-arch-linux/
|
||||
[2]: https://itsfoss.com/arch-based-linux-distros/
|
||||
[3]: https://itsfoss.com/pacman-command/
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[5]: https://invent.kde.org/system/apper
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[7]: https://github.com/dekzi/dde-store
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[9]: https://invent.kde.org/plasma/discover
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[11]: https://freedesktop.org/software/PackageKit/index.html
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[13]: https://gitlab.gnome.org/GNOME/gnome-software
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[15]: https://itsfoss.com/synaptic-package-manager/
|
||||
[16]: https://itsfoss.com/aur-arch-linux/
|
||||
[17]: https://itsfoss.com/best-aur-helpers/
|
||||
[18]: https://sourceforge.net/projects/tkpacman
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[20]: https://github.com/aarnt/octopi
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/09/apper-arch-install-firefox.png
|
||||
[22]: https://gitlab.manjaro.org/applications/pamac/-/issues/1017
|
||||
[23]: https://itsfoss.com/install-pamac-arch-linux/
|
||||
[24]: https://gitlab.manjaro.org/applications/pamac
|
||||
[25]: https://github.com/schuay/pcurses
|
||||
[26]: https://github.com/gavinlyonsrepo/cylon
|
||||
[27]: https://github.com/moson-mo/pacseek
|
||||
[28]: https://github.com/ericm/yup
|
||||
[29]: https://bugs.archlinux.org/task/50459
|
@ -1,181 +0,0 @@
|
||||
[#]: subject: "How to Enable RPM Fusion Repo in Fedora, CentOS, RHEL"
|
||||
[#]: via: "https://www.debugpoint.com/enable-rpm-fusion-fedora-rhel-centos/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Enable RPM Fusion Repo in Fedora, CentOS, RHEL
|
||||
======
|
||||
This guide explains the steps to enable third-party software repository RPM Fusion in Fedora Linux Distribution.
|
||||
|
||||
The [RPM Fusion][1] software repo is a community-maintained software repo that provides additional packages for Fedora Linux which is not distributed by the official Fedora team such as DVD playback, media playback, software from GNOME and KDE work, etc. This is because of licensing, other legal reasons, and country-specific software norms.
|
||||
|
||||
The RPM Fusion provides .rpm packages for Red Hat Enterprise Linux as well alongside Fedora.
|
||||
|
||||
This guide explains the steps you need to enable the RPM Fusion repo in Fedora Linux. This guide applies to all Fedora release versions.
|
||||
|
||||
This is tested in all the current supported Fedora versions – 35, 36 and 37.
|
||||
|
||||
![RPM Fusion][2]
|
||||
|
||||
### How to Enable RPM Fusion Repo in Fedora Linux, RHEL, CentOS
|
||||
|
||||
RPM Fusion has two flavours of the repo. Free and non-Free.
|
||||
|
||||
The Free one, as its name says, contains a free version of software packages and the non-free ones contain compiled packages of closed source and “non-commercial” open-source software.
|
||||
|
||||
Before you proceed, first check whether you have RPM fusion installed. Open up a terminal and run the below command.
|
||||
|
||||
```
|
||||
dnf repolist | grep rpmfusion
|
||||
```
|
||||
|
||||
If RPM is installed, you should see a message like the one below. Then no need to proceed at all. If it is not installed, you may proceed with the following steps.
|
||||
|
||||
![RPM-Fusion-Already-Installed-][3]
|
||||
|
||||
Open a terminal and run the below commands as per your operating system versions. Please note that the commands contain both a free and non-free version. If you want, you can omit either one from below while running.
|
||||
|
||||
#### Fedora
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
#### Silverblue with rpm-ostree
|
||||
|
||||
```
|
||||
sudo rpm-ostree install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo rpm-ostree install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
#### RHEL 8
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheckhttps://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(uname -m)-rpms"
|
||||
```
|
||||
|
||||
#### CentOS 8
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install --nogpgcheckhttps://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf config-manager --enable PowerTools
|
||||
```
|
||||
|
||||
### Additional Instructions
|
||||
|
||||
* RPM Fusion also provides to help users install packages from GNOME Software or KDE Discover. To enable it in Fedora, run the below command.
|
||||
|
||||
```
|
||||
sudo dnf groupupdate core
|
||||
```
|
||||
|
||||
* You can also enable RPM Fusion to play multimedia files that use gstreamer, and additional multimedia playback packages via the below command.
|
||||
|
||||
```
|
||||
sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf groupupdate sound-and-video
|
||||
```
|
||||
|
||||
* Enable RPM Fusion to play a DVD that uses libdvdcss.
|
||||
|
||||
```
|
||||
sudo dnf install rpmfusion-free-release-taintedsudo dnf install libdvdcss
|
||||
```
|
||||
|
||||
* Enable RPM Fusion to enable non-FLOSS hardware packages via the below command.
|
||||
|
||||
```
|
||||
sudo dnf install rpmfusion-nonfree-release-taintedsudo dnf install *-firmware
|
||||
```
|
||||
|
||||
After running the commands, if you are using Fedora or CentOS/RHEL – run the below commands before rebooting.
|
||||
|
||||
```
|
||||
sudo dnf check-updatesudo dnf update
|
||||
```
|
||||
|
||||
### How to remove repo using dnf
|
||||
|
||||
If you want to remove the repository, follow the steps below.
|
||||
|
||||
First, check using the below command to view the repo list added to your Fedora system.
|
||||
|
||||
```
|
||||
dnf repolist
|
||||
```
|
||||
|
||||
![dnf repolist][4]
|
||||
|
||||
As you can see, both rpmfusion free and non-free repo is added. To remove it via dnf, you need to know precisely the repo file name using the following command.
|
||||
|
||||
```
|
||||
rpm -qa 'rpmfusion*'
|
||||
```
|
||||
|
||||
This would list the exact name of the repo. In the example, they are ‘rpmfusion-free-release’.
|
||||
|
||||
![remove rpmfusion from fedora][5]
|
||||
|
||||
Now you can simply run the below command to remove it.
|
||||
|
||||
```
|
||||
sudo dnf remove rpmfusion-free-release
|
||||
```
|
||||
|
||||
You can repeat the above example to remove rpmfusion from Fedora, also, use this to remove any other repo from your system.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/enable-rpm-fusion-fedora-rhel-centos/
|
||||
|
||||
作者:[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://rpmfusion.org/
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2020/07/rpmfusion.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2020/07/RPM-Fusion-Already-Installed-.png
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2020/07/dnf-repolist.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2020/07/remove-rpmfusion-from-fedora.jpg
|
@ -1,216 +0,0 @@
|
||||
[#]: subject: "How to Create LVM Partition Step-by-Step in Linux"
|
||||
[#]: via: "https://www.linuxtechi.com/how-to-create-lvm-partition-in-linux/"
|
||||
[#]: author: "James Kiarie https://www.linuxtechi.com/author/james/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Create LVM Partition Step-by-Step in Linux
|
||||
======
|
||||
In this guide, we will cover how to create lvm partition step-by-step in Linux.
|
||||
|
||||
LVM stands for Logical Volume Management, it is the recommended way to manage disk or storage on Linux systems specially for servers. One of the main advantages of LVM partition is that we can extend its size online without any downtime. LVM partition can also be reduced but it is not recommended.
|
||||
|
||||
For the demo purpose, I have attached 15GB disk to my Ubuntu 22.04 system, we will create LVM partition on this disk from the command line.
|
||||
|
||||
##### Prerequisites
|
||||
|
||||
* Raw disk attached to Linux system
|
||||
* Local User with Sudo rights
|
||||
* Pre-Installed lvm2 package
|
||||
|
||||
Without further ado, let’s deep dive into the steps.
|
||||
|
||||
### Step 1) Identify new attached raw disk
|
||||
|
||||
Login to your system, open the terminal and run following dmesg command,
|
||||
|
||||
```
|
||||
$ sudo dmesg | grep -i sd
|
||||
```
|
||||
|
||||
In the output, look for new disk attached of size 15GB,
|
||||
|
||||
![dmesg-command-new-attached-disk-linux][1]
|
||||
|
||||
Alternate way to identify new attached raw disk is via fdisk command,
|
||||
|
||||
```
|
||||
$ sudo fdisk -l | grep -i /dev/sd
|
||||
```
|
||||
|
||||
Output,
|
||||
|
||||
![fdisk-command-output-new-disk][2]
|
||||
|
||||
From output above, it is confirmed that new attached disk is ‘/dev/sdb’
|
||||
|
||||
### Step 2) Create PV (Physical Volume)
|
||||
|
||||
Before start creating pv on disk /dev/sdb, make sure lvm2 package is installed. In case it is not installed, then run following command,
|
||||
|
||||
```
|
||||
$ sudo apt install lvm2 // On Ubuntu / Debian
|
||||
$ sudo dnf install lvm2 // on RHEL / CentOS
|
||||
```
|
||||
|
||||
Run following pvcreate command to create pv on disk /dev/sdb,
|
||||
|
||||
```
|
||||
$ sudo pvcreate /dev/sdb
|
||||
Physical volume "/dev/sdb" successfully created.
|
||||
$
|
||||
```
|
||||
|
||||
To verify pv status run,
|
||||
|
||||
```
|
||||
$ sudo pvs /dev/sdb
|
||||
Or
|
||||
$ sudo pvdisplay /dev/sdb
|
||||
```
|
||||
|
||||
![pvdisplay-command-output-linux][3]
|
||||
|
||||
### Step 3) Create VG (Volume Group)
|
||||
|
||||
To create a volume group, we will use vgcreate command. Creating VG means adding pv to the volume group.
|
||||
|
||||
Syntax :
|
||||
|
||||
```
|
||||
$ sudo vgcreare <vg_name> <pv>
|
||||
```
|
||||
|
||||
In our case, command would be,
|
||||
|
||||
```
|
||||
$ sudo vgcreate volgrp01 /dev/sdb
|
||||
Volume group "volgrp01" successfully created
|
||||
$
|
||||
```
|
||||
|
||||
Run following commands to verify the status of vg (volgrp01)
|
||||
|
||||
```
|
||||
$ sudo vgs volgrp01
|
||||
Or
|
||||
$ sudo vgdisplay volgrp01
|
||||
```
|
||||
|
||||
Output of above commands,
|
||||
|
||||
![vgs-command-output-linux][4]
|
||||
|
||||
Above output confirms that volume group (volgrp01) of size 15 GiB is created successful and size of one physical extend (PE) is 4 MB. PE size can be changed while creating vg.
|
||||
|
||||
### Step 4) Create LV (Logical Volume)
|
||||
|
||||
|
||||
Lvcreate command is used to create LV from the VG. Syntax of lvcreate command would look like below,
|
||||
|
||||
```
|
||||
$ sudo lvcreate -L <Size-of-LV> -n <LV-Name> <VG-Name>
|
||||
```
|
||||
|
||||
In our case, following command will be used to create lv of size 14 GB
|
||||
|
||||
```
|
||||
$ sudo lvcreate -L 14G -n lv01 volgrp01
|
||||
Logical volume "lv01" created.
|
||||
$
|
||||
```
|
||||
|
||||
Validate the status of lv, run
|
||||
|
||||
```
|
||||
$ sudo lvs /dev/volgrp01/lv01
|
||||
or
|
||||
$ sudo lvdisplay /dev/volgrp01/lv01
|
||||
```
|
||||
|
||||
Output,
|
||||
|
||||
![lvs-command-output-linux][5]
|
||||
|
||||
Output above shows that LV (lv01) has been created successfully of size 14 GiB.
|
||||
|
||||
### Step 5) Format LVM Partition
|
||||
|
||||
Use mkfs command to format the lvm partition. In our case lvm partition is /dev/volgrp01/lv01
|
||||
|
||||
Note: We can format the partition either ext4 or xfs, so choose the file system type according to your setup and requirement.
|
||||
|
||||
Run following command to format LVM partition as ext4 file system.
|
||||
|
||||
```
|
||||
$ sudo mkfs.ext4 /dev/volgrp01/lv01
|
||||
```
|
||||
|
||||
![mkfs-ext4-filesystem-lvm][6]
|
||||
|
||||
Execute beneath command to format the lvm partition with xfs file system,
|
||||
|
||||
```
|
||||
$ sudo mkfs.xfs /dev/volgrp01/lv01
|
||||
```
|
||||
|
||||
To use above formatted partition, we must mount it on some folder. So, let’s create a folder /mnt/data
|
||||
|
||||
```
|
||||
$ sudo mkdir /mnt/data
|
||||
```
|
||||
|
||||
Now run mount command to mount it on /mnt/data folder,
|
||||
|
||||
```
|
||||
$ sudo mount /dev/volgrp01/lv01 /mnt/data/
|
||||
$ df -Th /mnt/data/
|
||||
Filesystem Type Size Used Avail Use% Mounted on
|
||||
/dev/mapper/volgrp01-lv01 ext4 14G 24K 13G 1% /mnt/data
|
||||
$
|
||||
```
|
||||
|
||||
Try to create some dummy file, run following commands,
|
||||
|
||||
```
|
||||
$ cd /mnt/data/
|
||||
$ echo "testing lvm partition" | sudo tee dummy.txt
|
||||
$ cat dummy.txt
|
||||
testing lvm partition
|
||||
$
|
||||
$ sudo rm -f dummy.txt
|
||||
```
|
||||
|
||||
Perfect, above commands output confirm that we can access lvm partition.
|
||||
|
||||
To mount above lvm partition permanently, add its entries in fstab file using following echo command,
|
||||
|
||||
```
|
||||
$ echo '/dev/volgrp01/lv01 /mnt/data ext4 defaults 0 0' | sudo tee -a /etc/fstab
|
||||
$ sudo mount -a
|
||||
```
|
||||
|
||||
That’s all from this guide, thanks for the reading. Kindly do post your queries and feedback in below comments section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/how-to-create-lvm-partition-in-linux/
|
||||
|
||||
作者:[James Kiarie][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/james/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.linuxtechi.com/wp-content/uploads/2022/10/dmesg-command-new-attached-disk-linux.png
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2022/10/fdisk-command-output-new-disk.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2022/10/pvdisplay-command-output-linux.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2022/10/vgs-command-output-linux.png
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2022/10/lvs-command-output-linux.png
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2022/10/mkfs-ext4-filesystem-lvm.png
|
@ -0,0 +1,382 @@
|
||||
[#]: subject: "14 Best Open Source WYSIWYG HTML Editors"
|
||||
[#]: via: "https://itsfoss.com/open-source-wysiwyg-editors/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
14 Best Open Source WYSIWYG HTML Editors
|
||||
======
|
||||
WYSIWYG (What You See Is What You Get) editors are self-explanatory. Whatever you see when editing is what you, a reader/user see.
|
||||
|
||||
Whether you want to build your content management system, or aim to provide an editor to the end-user of your application, an open-source WYSIWYG editor will help provide a secure, modern, and scalable experience. Of course, you also get the technical freedom to customize open-source WYSIWYG editors to meet your requirements.
|
||||
|
||||
Here, we look at some of the best open-source WYSIWYG editors.
|
||||
|
||||
### Things to Look For When Choosing a WYSIWYG HTML Editor
|
||||
|
||||
![best open source wysiwyg editors][1]
|
||||
|
||||
A document editor must be fast for some users and loaded with features.
|
||||
|
||||
Similarly, what are some of the key highlights that you should look at when selecting an HTML editor? Let me give you some pointers here:
|
||||
|
||||
* Is the editor lightweight?
|
||||
* Does it have SEO-friendly features?
|
||||
* How well does it let you collaborate?
|
||||
* Does it offer auto-save functionality?
|
||||
* Can you check spelling and grammar with it?
|
||||
* How well does it handle images/galleries?
|
||||
|
||||
When selecting an open-source HTML editor for your app or website, you should look for these essential aspects.
|
||||
|
||||
Keeping these in mind, let me mention some of the best options to try.
|
||||
|
||||
**Note:** *The editors are in no particular order of ranking. You may choose the best for your use case.*
|
||||
|
||||
Table of Contents
|
||||
|
||||
* Things to Look For When Choosing a WYSIWYG HTML Editor
|
||||
* 1. CKEditor
|
||||
* 2. Froala
|
||||
* 3. TinyMCE
|
||||
* 4. Quilljs
|
||||
* 5. Aloha Editor
|
||||
* 6. Editor.js
|
||||
* 7. Trix
|
||||
* 8. Summernote
|
||||
* 9. ContentTools
|
||||
* 10. Toast UI Editor
|
||||
* 11. Jodit
|
||||
* 12. SCEditor
|
||||
* 13. SunEditor
|
||||
* 14. ProseMirror
|
||||
* Picking The Best Open-Source WYSIWYG Editor
|
||||
|
||||
### 1. CKEditor
|
||||
|
||||
![ck5 editor][2]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Autosave.
|
||||
* Drag and drop support.
|
||||
* Responsive images.
|
||||
* Supports pasting from Word/GDocs while preserving the formatting.
|
||||
* Autoformatting, HTML/Markdown support, Font Style customization.
|
||||
* Image alt text.
|
||||
* Real-time Collaboration (Premium only).
|
||||
* Revision History (Premium only).
|
||||
* Spell and grammar check (Premium only).
|
||||
|
||||
CKEditor 5 is a feature-rich and open-source WYSIWYG editing solution with great flexibility. The user interface looks modern. Hence, you may expect a modern user experience.
|
||||
|
||||
It offers a free edition and a premium plan with extra features. CKEditor is a popular option among enterprises and several publications with a custom Content Management System (CMS), for which they provide technical support and custom deployment options.
|
||||
|
||||
CKeditor’s free edition should provide basic editing capabilities if you do not need an enterprise-grade offering. Check out its [GitHub page][3] to explore.
|
||||
|
||||
[CKEditor 5][4]
|
||||
|
||||
### 2. Froala
|
||||
|
||||
![froala][5]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Simple user interface and Responsive Design.
|
||||
* Easy to integrate.
|
||||
* HTML/Markdown support.
|
||||
* Theme/Custom style support.
|
||||
* Lightweight.
|
||||
* Image Manager and alt text.
|
||||
* Autosave.
|
||||
|
||||
Froala is an exciting web editor that you can easily integrate with your existing [open-source CMS][6] like WordPress.
|
||||
|
||||
It provides a simple user interface with the ability to extend its functionality through default plugins. You can use it as a simple editor or add more tools to the interface for a powerful editing experience.
|
||||
|
||||
You can self-host it, but to access its mobile apps and premium support, you must opt for one of the paid plans. Head to its [GitHub page][7] to explore more.
|
||||
|
||||
[Froala][8]
|
||||
|
||||
### 3. TinyMCE
|
||||
|
||||
![tinymce editor][9]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Autosave.
|
||||
* Lightweight.
|
||||
* Emoticons.
|
||||
* Manage images.
|
||||
* Preview.
|
||||
* Color picker tool.
|
||||
|
||||
TinyMCE is an incredibly popular option for users looking to use a solid editor with several integration options.
|
||||
|
||||
TinyMCE was the editor powering WordPress with proven flexibility and ease of use for all users. Unless you want real-time collaboration and cloud deployments at your disposal, TinyMCE’s free self-hosted edition should serve you well.
|
||||
|
||||
It is a lightweight option with essential features to work with. Check out more about it on its [GitHub page][10].
|
||||
|
||||
[TinyMCE][11]
|
||||
|
||||
### 4. Quilljs
|
||||
|
||||
![quilljs][12]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Lightweight.
|
||||
* Extend functionalities using extensions.
|
||||
* Simple and easy to use.
|
||||
|
||||
Do you like Slack’s in-app editor or LinkedIn’s web editor? Quilljs is what they use to offer that experience.
|
||||
|
||||
If you are looking for a polished free, open-source WYSIWYG editor with no premium frills, Quill (or Quilljs) should be the perfect text editor. It is a lightweight editor with a minimal user interface that allows you to customize or add your extensions to scale their functionalities per your requirements.
|
||||
|
||||
To explore its technical details, head to its [GitHub page][13].
|
||||
|
||||
[Quilljs][14]
|
||||
|
||||
### 5. Aloha Editor
|
||||
|
||||
![A Video from YouTube][15]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Fast editor.
|
||||
* Front-end editing.
|
||||
* Supports clean copy/paste from Word.
|
||||
* Easy integration.
|
||||
* Plugin support.
|
||||
* Customization for look and feel.
|
||||
|
||||
Aloha Editor is a simple and fast HTML5 WYSIWYG editor that lets you edit the content on the front end.
|
||||
|
||||
You can download and use it for free. But, if you need professional help, you can contact them for paid options. Its [GitHub page][16] should be the perfect place to explore its technical details.
|
||||
|
||||
[Aloha Editor][17]
|
||||
|
||||
### 6. Editor.js
|
||||
|
||||
![editor js 1][18]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Block-style editing.
|
||||
* Completely free and open-source.
|
||||
* Plugin support.
|
||||
* Collaborative editing (in roadmap).
|
||||
|
||||
Editor.js gives you the perks of a block-style editor. The headings, paragraphs, and other items are all separate blocks, which makes them editable while not affecting the rest of the content.
|
||||
|
||||
It is an entirely free and open-source project with no premium extras available for upgrade. However, there are several plugins to extend the features, and you can also explore its [GitHub page][19] for more info.
|
||||
|
||||
[Editor.js][20]
|
||||
|
||||
### 7. Trix
|
||||
|
||||
![trix editor][21]
|
||||
|
||||
**Note:** *This project hasn’t seen any new activity for more than a year when writing.*
|
||||
|
||||
Trix is an open-source project by the creators of Ruby on Rails.
|
||||
|
||||
If you want something different for a change, with the basic functionalities of a web editor, Trix can be a pick. The project describes that it is built for the modern web.
|
||||
|
||||
Trix is not a popular option, but it is a respectable project that lets tinkerers try something different for their website or app. You can explore more on its [GitHub page][22].
|
||||
|
||||
[Trix][23]
|
||||
|
||||
### 8. Summernote
|
||||
|
||||
![summernote][24]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Lightweight.
|
||||
* Simple user interface.
|
||||
* Plugins supported.
|
||||
|
||||
Want something similar to TincyMCE but simpler? Summernote can be a good choice.
|
||||
|
||||
It provides the look and feel of a classic web editor without any fancy modern UX elements. The focus of this editor is to offer a simple and fast experience along with the ability to add plugins and connectors.
|
||||
|
||||
You also get to change the themes according to Bootstraps used. Yes, an editor on Bootstrap. Explore more about it on its [GitHub page][25].
|
||||
|
||||
[Summernote][26]
|
||||
|
||||
### 9. ContentTools
|
||||
|
||||
![content tools][27]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Easy-to-use.
|
||||
* Completely free.
|
||||
* Lightweight.
|
||||
|
||||
Want to edit HTML pages from the front end? Well, ContentTools lets you do that pretty quickly.
|
||||
|
||||
While it can be integrated with a CMS, it may not be a preferred pick for the job. You can take a look around at its [GitHub page][28] as well.
|
||||
|
||||
[ContentTools][29]
|
||||
|
||||
### 10. Toast UI Editor
|
||||
|
||||
![toast ui editor][30]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Specially focused on Markdown editing/pages.
|
||||
* Plugins supported.
|
||||
* Live Preview.
|
||||
|
||||
Toast UI editor will be a perfect fit if you deal with Markdown documents to publish web pages.
|
||||
|
||||
It offers a live preview and a few essential options for edits. You also get a dark theme and plugin support for extended functions.
|
||||
|
||||
While it does provide useful features, it may not be a feature-rich editor for all. Learn more about it on its [GitHub page][31].
|
||||
|
||||
[Toast UI Editor][32]
|
||||
|
||||
### 11. Jodit
|
||||
|
||||
![jodit screenshot][33]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Lightweight.
|
||||
* TypeScript based.
|
||||
* Plugin support.
|
||||
|
||||
Jodit is a TypeScript-based WYSIWYG editor that makes no use of additional libraries.
|
||||
|
||||
It is a simple and helpful editor with all the essential editing features, including drag-and-drop support and a plugin system to extend functionalities.
|
||||
|
||||
The user experience is much similar to WordPress’s classic editor or TinyMCE. You can opt for its pro version to access additional plugins and technical support. Head to its [GitHub page][34] to explore technical details.
|
||||
|
||||
[Jodit][35]
|
||||
|
||||
### 12. SCEditor
|
||||
|
||||
![sceditor][36]
|
||||
|
||||
Key Features:
|
||||
|
||||
* Simple and easy to use.
|
||||
* Completely free.
|
||||
* Lightweight.
|
||||
* Plugins support.
|
||||
|
||||
SCEditor is yet another simple open-source WYSIWYG editor. It may not be popular enough, but it has been actively maintained for more than six years since publishing.
|
||||
|
||||
By default, it does not feature drag-and-drop support, but you can add it using a plugin. There is scope for using multiple themes and customizing the icons as well. Learn more about it on its [GitHub page][37].
|
||||
|
||||
[SCEditor][38]
|
||||
|
||||
### 13. SunEditor
|
||||
|
||||
![suneditor][39]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Feature-rich.
|
||||
* Completely free.
|
||||
* Plugin supported.
|
||||
|
||||
Like the last one, SunEditor is not popular enough but works well with its simple and feature-rich offering.
|
||||
|
||||
It is based on pure JavaScript with no dependencies. You should be able to copy from Microsoft Word and Excel without issues.
|
||||
|
||||
Additionally, one can use KaTex (math plugin) as well. It gives you complete freedom with custom plugins as well. There are no premium extras here. Head to its [GitHub page][40] to check out its recent releases.
|
||||
|
||||
### 14. ProseMirror
|
||||
|
||||
![prosemirror][41]
|
||||
|
||||
#### Key Features:
|
||||
|
||||
* Collaboration capabilities.
|
||||
* Modular.
|
||||
* Simple.
|
||||
* Plugins support.
|
||||
|
||||
ProseMirror is an exciting choice for free for users who want collaborative editing capabilities. Most of the WYSIWYG editors offer the collaboration feature for a premium. But here, you can work with others on the same document in real-time (for free).
|
||||
|
||||
It provides a modular architecture that makes maintenance and development more accessible compared to others.
|
||||
|
||||
Explore more about it on its [GitHub page][42].
|
||||
|
||||
[ProseMirror][43]
|
||||
|
||||
### Picking The Best Open-Source WYSIWYG Editor
|
||||
|
||||
Depending on the type of use case, it is easy to pick a WYSIWYG, an open-source editor.
|
||||
|
||||
If you want to focus on the out-of-the-box experience and reduce efforts to maintain it, any option that provides premium technical support should be a good choice.
|
||||
|
||||
If you are more of a DIY user, you should do anything that serves your requirements.
|
||||
|
||||
Note that a popular option does not mean that it is a flawless editor for your requirements. Sometimes a more straightforward option is a better solution than a feature-rich editor.
|
||||
|
||||
*So, what would be your favorite open-source HTML editor?* *Let me know in the comments below.*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/open-source-wysiwyg-editors/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2022/10/best-open-source-wysiwyg-editors.png
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/10/ck5-editor.webp
|
||||
[3]: https://github.com/ckeditor/ckeditor5
|
||||
[4]: https://ckeditor.com/ckeditor-5/
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/10/froala.jpg
|
||||
[6]: https://itsfoss.com/open-source-cms/
|
||||
[7]: https://github.com/froala
|
||||
[8]: https://froala.com/wysiwyg-editor/
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/10/tinymce-editor.jpg
|
||||
[10]: https://github.com/tinymce/tinymce
|
||||
[11]: https://www.tiny.cloud/
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/10/quilljs.jpg
|
||||
[13]: https://github.com/quilljs/quill
|
||||
[14]: https://quilljs.com/
|
||||
[15]: https://youtu.be/w_oXaW5Rrpc
|
||||
[16]: https://github.com/alohaeditor/Aloha-Editor
|
||||
[17]: https://www.alohaeditor.org/
|
||||
[18]: https://itsfoss.com/wp-content/uploads/2022/10/editor-js-1.jpg
|
||||
[19]: https://github.com/codex-team/editor.js
|
||||
[20]: https://editorjs.io/
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/10/trix-editor.jpg
|
||||
[22]: https://github.com/basecamp/trix
|
||||
[23]: https://trix-editor.org/
|
||||
[24]: https://itsfoss.com/wp-content/uploads/2022/10/summernote.jpg
|
||||
[25]: https://github.com/summernote/summernote/
|
||||
[26]: https://summernote.org/
|
||||
[27]: https://itsfoss.com/wp-content/uploads/2022/10/content-tools.jpg
|
||||
[28]: https://github.com/GetmeUK/ContentTools
|
||||
[29]: https://getcontenttools.com/
|
||||
[30]: https://itsfoss.com/wp-content/uploads/2022/10/toast-ui-editor.jpg
|
||||
[31]: https://github.com/nhn/tui.editor
|
||||
[32]: https://ui.toast.com/tui-editor
|
||||
[33]: https://itsfoss.com/wp-content/uploads/2022/10/jodit-screenshot.jpg
|
||||
[34]: https://github.com/xdan/jodit
|
||||
[35]: https://xdsoft.net/jodit/
|
||||
[36]: https://itsfoss.com/wp-content/uploads/2022/10/sceditor.jpg
|
||||
[37]: https://github.com/samclarke/SCEditor
|
||||
[38]: https://www.sceditor.com/
|
||||
[39]: https://itsfoss.com/wp-content/uploads/2022/10/suneditor.png
|
||||
[40]: https://github.com/JiHong88/SunEditor
|
||||
[41]: https://itsfoss.com/wp-content/uploads/2022/10/prosemirror.jpg
|
||||
[42]: https://github.com/ProseMirror/prosemirror
|
||||
[43]: https://prosemirror.net/
|
@ -0,0 +1,93 @@
|
||||
[#]: subject: "How to Update Google Chrome on Ubuntu Linux"
|
||||
[#]: via: "https://itsfoss.com/update-google-chrome-ubuntu/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Update Google Chrome on Ubuntu Linux
|
||||
======
|
||||
So, you managed to install Google Chrome browser on your Ubuntu system. And now you wonder how to keep the browser updated.
|
||||
|
||||
On Windows and macOS, when there is an update available on Chrome, you are notified in the browser itself and you can hit the update option from the browser.
|
||||
|
||||
Things are different in Linux. You don’t update Chrome from the browser. You update it with the system updates.
|
||||
|
||||
Yes. When there is a new update available on Chrome, Ubuntu notifies you via the system updater tool.
|
||||
|
||||
![Ubuntu sends notifications when a new version of Chrome is available][1]
|
||||
|
||||
You just have to click on the Install Now button, enter your account’s password when asked for it and have Chrome updated to a new version.
|
||||
|
||||
Let me tell you why you see the updates on the system level and how you can update Google Chrome in the command line.
|
||||
|
||||
### Method 1: Updating Google Chrome with system updates
|
||||
|
||||
How did you install Chrome in the first place? You got the deb installer file from the [Chrome website][2] and used it to [install Chrome on Ubuntu][3].
|
||||
|
||||
The thing is that when you do that, Google adds a repository entry into your system’s sources list. This way, your system trusts the packages coming from the Google repository.
|
||||
|
||||
![Google Chrome repository is added to the Ubuntu system][4]
|
||||
|
||||
For all such entries added to your system, the package updates are centralized through the Ubuntu Updater.
|
||||
|
||||
And this is why when there is an update available to Google Chrome (and other installed applications), your Ubuntu system sends you notification.
|
||||
|
||||
![Chrome update available with other applications via System Updater][5]
|
||||
|
||||
**Click the “Install Now” button and enter your password when asked for it**. Soon, the system will install all the upgradeable packages.
|
||||
|
||||
Depending on the update preference, the notification may not be immediate. If you want, you can manually run the updater tool and see what updates are available for your Ubuntu system.
|
||||
|
||||
![Run Software Updater to see what updates are available for your system][6]
|
||||
|
||||
### Method 2: Updating Chrome in the Ubuntu command line
|
||||
|
||||
If you prefer the terminal over the graphical interface, you can update Chrome with commands as well.
|
||||
|
||||
Open a terminal and run the following commands one by one:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
|
||||
sudo apt --only-upgrade install google-chrome-stable
|
||||
```
|
||||
|
||||
The first command updates the package cache so that your system is aware of what packages can be upgraded.
|
||||
|
||||
The second command [only updates the single package][7] which is Google Chrome (installed as google-chrome-stable).
|
||||
|
||||
### Conclusion
|
||||
|
||||
As you can see, things are more streamlined in Ubuntu than in Windows. You get Chrome updated along with other system updates.
|
||||
|
||||
On a related note, you may learn about [removing google Chrome from Ubuntu][8] if you are unhappy with it.
|
||||
|
||||
Chrome is a fine browser. You can experiment with it by [using shortcuts in Chrome][9] as it makes the browsing experience even smoother.
|
||||
|
||||
Enjoy Chrome on Ubuntu!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/update-google-chrome-ubuntu/
|
||||
|
||||
作者:[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/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2021/06/chrome-edge-update-ubuntu.png
|
||||
[2]: https://www.google.com/chrome/
|
||||
[3]: https://itsfoss.com/install-chrome-ubuntu/
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2021/06/google-chrome-repo-ubuntu.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2021/06/chrome-edge-update-ubuntu.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/04/software-updater-ubuntu-22-04.jpg
|
||||
[7]: https://itsfoss.com/apt-upgrade-single-package/
|
||||
[8]: https://itsfoss.com/uninstall-chrome-from-ubuntu/
|
||||
[9]: https://itsfoss.com/google-chrome-shortcuts/
|
@ -0,0 +1,81 @@
|
||||
[#]: subject: "Easiest Way to Open Files as Root in GNOME Files"
|
||||
[#]: via: "https://www.debugpoint.com/gnome-files-root-access/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Easiest Way to Open Files as Root in GNOME Files
|
||||
======
|
||||
Here’s the simplest way to access a file or directory as root in GNOME Files.
|
||||
|
||||
![][1]
|
||||
|
||||
In Windows, you generally get an option to open a file or folder as “Open As Administrator” in the right-click context menu.
|
||||
|
||||
That feature is part of the File manager, i.e. for Windows; it’s part of Windows Explorer. However, it is executed by the operating system and its permission control modules.
|
||||
|
||||
In Linux distributions and file managers, the situation is a little different. The different desktop has their way of handling this.
|
||||
|
||||
Since modifying the files and folders as admin (or root) is risky and may cause a broken system, the feature is not easily available to users via the GUI of file managers.
|
||||
|
||||
For example, KDE Plasma’s default file manager Dolphin recently [added this feature][2] so that when a root privilege is required, it will ask for you with a PolicyKit KDE Agent (polkit) window – as shown below. Not the other way around. You want to open/execute something via root from the file manager.
|
||||
|
||||
It’s worth mentioning that you can not use “sudo dolphin” to run the file manager itself with root privilege.
|
||||
|
||||
![Dolphin root access after KIO with Polkit implementation][3]
|
||||
|
||||
In a way, it saves many unforeseen situations. But advanced users can always use sudo via the terminal to do their job.
|
||||
|
||||
### GNOME Files (Nautilus) and root access to files, directories
|
||||
|
||||
That being said, [GNOME Files][4] (aka Nautilus) has a way to open files and folders via root.
|
||||
|
||||
Here’s how.
|
||||
|
||||
* Open GNOME Files or Nautilus.
|
||||
* Then click on other locations at the left pane.
|
||||
* Press CTRL+L to bring up the address bar.
|
||||
* In the address bar, type in below and hit enter.
|
||||
|
||||
```
|
||||
admin:///
|
||||
```
|
||||
|
||||
* It would ask for the admin password; once you authenticate yourself successfully, you get the system open for you as admin.
|
||||
* Now, here onwards, whatever you do, it’s as admin or root.
|
||||
|
||||
![Enter the location address as admin][5]
|
||||
|
||||
![Give admin password][6]
|
||||
|
||||
![Opening GNOME Files as root][7]
|
||||
|
||||
But, as always, be careful what you do as an admin. It’s often easy to forget after you authenticate yourself as root.
|
||||
|
||||
There’s always a reason why these options are not easily visible to prevent you and many new Linux users from breaking their system.
|
||||
|
||||
Cheers.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/gnome-files-root-access/
|
||||
|
||||
作者:[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/wp-content/uploads/2022/10/nauroot-1024x576.jpg
|
||||
[2]: https://www.debugpoint.com/dolphin-root-access/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/02/Dolphin-root-access-after-KIO-with-Polkit-implementation.jpg
|
||||
[4]: https://wiki.gnome.org/Apps/Files
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/10/Enter-the-location-address-as-admin.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/10/Give-admin-password.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/10/Opening-GNOME-Files-as-root.jpg
|
@ -0,0 +1,159 @@
|
||||
[#]: subject: "Groovy vs Java: Connecting a PostgreSQL database with JDBC"
|
||||
[#]: via: "https://opensource.com/article/22/10/groovy-vs-java-sql"
|
||||
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Groovy vs Java: Connecting a PostgreSQL database with JDBC
|
||||
======
|
||||
This example demonstrates how Groovy streamlines the clunkiness of Java.
|
||||
|
||||
![Coffee beans][1]
|
||||
|
||||
Image by: Pixabay. CC0.
|
||||
|
||||
Lately, I've been looking at how Groovy streamlines the slight clunkiness of Java. This article examines some differences between connecting to a PostgreSQL database using JDBC in Java versus Groovy.
|
||||
|
||||
### Install Java and Groovy
|
||||
|
||||
Groovy is based on Java and requires a Java installation. Both a recent/decent version of Java and Groovy might be in your Linux distribution's repositories, or you can install Groovy by following [these instructions][2]. A nice alternative for Linux users is SDKMan, which provides multiple versions of Java, Groovy, and many other related tools. For this article, I'm using SDK's releases of:
|
||||
|
||||
* Java version 11.0.12-open of OpenJDK 11
|
||||
* Groovy version 3.0.8
|
||||
|
||||
### Back to the problem
|
||||
|
||||
If you haven't already, please review [this article][3] on installing JDBC and [this article][4] on setting up PostgreSQL.
|
||||
|
||||
Whether you're using Java or Groovy, several basic steps happen in any program that uses JDBC to pull data out of a database:
|
||||
|
||||
1. Establish a `Connection` instance to the database back end where the data resides.
|
||||
2. Using an SQL string, get an instance of a `Statement` (or something similar, like a `PreparedStatement`) that will handle the execution of the SQL string.
|
||||
3. Process the `ResultSet` instance returned by having the `Statement` instance execute the query, for example, printing the rows returned on the console.
|
||||
4. Close the `Statement` and `Connection` instances when done.
|
||||
|
||||
In Java, the correspondence between the code and the list above is essentially one-for-one. Groovy, as usual, streamlines the process.
|
||||
|
||||
#### Java example
|
||||
|
||||
Here's the Java code to look at the land cover data I loaded in the second article linked above:
|
||||
|
||||
```
|
||||
1 import java.sql.Connection;
|
||||
2 import java.sql.Statement;
|
||||
3 import java.sql.ResultSet;
|
||||
4 import java.sql.DriverManager;
|
||||
5 import java.sql.SQLException;
|
||||
|
||||
6 public class TestQuery {
|
||||
|
||||
7 public static void main(String[] args) {
|
||||
|
||||
8 final String url = "jdbc:postgresql://localhost/landcover";
|
||||
9 final String user = "clh";
|
||||
10 final String password = "carl-man";
|
||||
11 try (Connection connection = DriverManager.getConnection(url, user, password)) {
|
||||
12 try (Statement statement = connection.createStatement()) {
|
||||
13 ResultSet res = statement.executeQuery("select distinct country_code from land_cover");
|
||||
14 while (res.next()) {
|
||||
15 System.out.println("country code " + res.getString("country_code"));
|
||||
16 }
|
||||
|
||||
17 } catch (SQLException se) {
|
||||
18 System.err.println(se.getMessage());
|
||||
19 }
|
||||
20 } catch (SQLException ce) {
|
||||
21 System.err.println(ce.getMessage());
|
||||
22 }
|
||||
23 }
|
||||
24 }
|
||||
```
|
||||
|
||||
Lines 1-5 are the necessary import statements for the JDBC classes. Of course, I could shorten this to `import java.sql.*` but that sort of thing is somewhat frowned-upon these days.
|
||||
|
||||
Lines 6-24 define the public class `TestQuery` I will use to connect to the database and print some of the contents of the main table.
|
||||
|
||||
Lines 7-23 define the `main` method that does the work.
|
||||
|
||||
Lines 8-10 define the three strings needed to connect to a database: The URL, the user name, and the user password.
|
||||
|
||||
Lines 11-22 use a try-with-resources to open the `Connection` instance and automatically close it when done.
|
||||
|
||||
Lines 12 -19 use another try-with-resources to open the `Statement` instance and automatically close it when done.
|
||||
|
||||
Line 13 creates the `ResultSet` instance handle the SQL query, which uses **SELECT DISTINCT** to get all unique values of **country_code** from the **land_cover** table in the database.
|
||||
|
||||
Lines 14-16 process the result set returned by the query, printing out the country codes one per line.
|
||||
|
||||
Lines 17-19 and 20-22 handle any SQL exceptions.
|
||||
|
||||
#### Groovy example
|
||||
|
||||
I'll do something similar in Groovy:
|
||||
|
||||
```
|
||||
1 import groovy.sql.Sql
|
||||
|
||||
2 final String url = "jdbc:postgresql://localhost/landcover"
|
||||
3 final String user = "me"
|
||||
4 final String password = "my-password"
|
||||
5 final String driver = "org.postgresql.Driver"
|
||||
|
||||
6 Sql.withInstance(url, user, password, driver) { sql ->
|
||||
|
||||
7 sql.eachRow('select distinct country_code from land_cover') { row ->
|
||||
8 println "row.country_code ${row.country_code}"
|
||||
9 }
|
||||
10 }
|
||||
```
|
||||
|
||||
Okay, that's a lot shorter–10 lines instead of 24! Here are the details:
|
||||
|
||||
Line 1 is the only import needed. In my view, not having to jump around JavaDocs for three different classes is a distinct advantage.
|
||||
|
||||
Lines 2-5 define the four strings needed to connect to a database using the `Sql` class. The first three are the same as for `java.sql.Connection` ; the fourth names the driver I want.
|
||||
|
||||
Line 6 is doing a bunch of heavy lifting. The method call is `Sql.withInstance()`, similar to other uses of "with" in Groovy. The call:
|
||||
|
||||
* Creates an instance of `Sql` (connection, statement, etc.).
|
||||
* Takes a closure as its final parameter, passing it the instance of `Sql` that it created.
|
||||
* Closes the instance of `Sql` when the closure exits.
|
||||
|
||||
Line 7 calls the `eachRow()` method of the `Sql` instance, wrapping the creation and processing of the result set. The `eachRow()` method takes a closure as its final argument and passes each `row` to the closure as it processes the returned lines of data from the table.
|
||||
|
||||
### Groovy can simplify your life
|
||||
|
||||
For those of you whose day job involves scripting and relational databases, I think it's pretty obvious from the above that Groovy can simplify your life. A few closing comments:
|
||||
|
||||
* I could have accomplished this similarly to the Java version; for example, instead of calling `sql.eachRow()`, I could have called `sql.query()`, which takes a closure as its last argument and passes a result set to that closure, at which point I would have probably used a `while()` as in the Java version (or maybe `each()`).
|
||||
* I could also read the resulting rows into a list, all at once, using a call to `sql.rows()`, which can transform the data in a manner similar to using `.collect()` on a list.
|
||||
* Remember that the SQL passed into the `eachRow()` (or `query()`) method can be arbitrarily complex, including table joins, grouping, ordering, and any other operations supported by the database in question.
|
||||
* Note that SQL can also be parametrized when using an instance of `PreparedStatement`, which is a nice way to avoid SQL injection if any part of the SQL comes in from outside the coder's sphere of control.
|
||||
* This is a good moment to point the diligent reader to the [JavaDocs for groovy.sql.Sql][5].
|
||||
|
||||
### Groovy resources
|
||||
|
||||
The [Apache Groovy language site][6] provides a good tutorial-level overview of working with databases, including other ways to connect, plus additional operations, including insertions, deletions, transactions, batching, pagination—the list goes on. This documentation is quite concise and easy to follow, at least partly because the facility it is documenting has itself been designed to be concise and easy to use!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/groovy-vs-java-sql
|
||||
|
||||
作者:[Chris Hermansen][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/clhermansen
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/java-coffee-beans.jpg
|
||||
[2]: https://groovy.apache.org/download.html
|
||||
[3]: https://opensource.com/article/22/9/install-jdbc-linux
|
||||
[4]: https://opensource.com/article/22/9/drop-your-database-for-postgresql
|
||||
[5]: https://docs.groovy-lang.org/latest/html/api/index.html
|
||||
[6]: https://groovy-lang.org/
|
@ -0,0 +1,125 @@
|
||||
[#]: subject: "How to Set Static IP Address on Ubuntu Server 22.04"
|
||||
[#]: via: "https://www.linuxtechi.com/static-ip-address-on-ubuntu-server/"
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Set Static IP Address on Ubuntu Server 22.04
|
||||
======
|
||||
In this post, we will cover how to set static ip address on Ubuntu server 22.04.
|
||||
|
||||
It is highly recommended to have a static ip on linux server because it would be persistent across the reboot. Static IP plays an important role for servers like Mail Server, Web Server and File server etc.
|
||||
|
||||
##### Prerequisites
|
||||
|
||||
* Minimal Installed Ubuntu Server 22.04
|
||||
* Regular User with sudo admin rights
|
||||
|
||||
In Ubuntu server 22.04, networking is controlled by netplan utility, so we will use netplan to configure static ip address on Ubuntu server.
|
||||
|
||||
Note: we cannot use [nmcli utiltity][1] as it is not the part of default installation on Ubuntu server.
|
||||
|
||||
### Setting up Static IP address on Ubuntu Server 22.04
|
||||
|
||||
Login to your Ubuntu server 22.04, look for the netplan configuration file. It is located under /etc/netplan directory.
|
||||
|
||||
```
|
||||
$ cd /etc/netplan/
|
||||
$ ls -l
|
||||
total 4
|
||||
-rw-r--r-- 1 root root 116 Oct 12 04:03 00-installer-config.yaml
|
||||
$
|
||||
```
|
||||
|
||||
Run below cat command to view the contents of ‘00-installer-config.yaml’
|
||||
|
||||
Note: Name of configuration file may differ as your per setup. As it is an yaml file, so make sure to maintain the indentation and syntax while editing.
|
||||
|
||||
```
|
||||
$ cat 00-installer-config.yaml
|
||||
```
|
||||
|
||||
Output,
|
||||
|
||||
![Default-Content-netplan-ubuntu-server][2]
|
||||
|
||||
As per above output, it says that we have ens33 interface and it is getting ip from dhcp server. Alternate way to view interface name is via ip command.
|
||||
|
||||
Now, to configure static ip in place of dhcp, edit netplan configuration file using vi or nano editor and add the following content.
|
||||
|
||||
```
|
||||
$ sudo vi 00-installer-config.yaml
|
||||
# This is the network config written by 'subiquity'
|
||||
network:
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
ens33:
|
||||
addresses:
|
||||
- 192.168.1.247/24
|
||||
nameservers:
|
||||
addresses: [4.2.2.2, 8.8.8.8]
|
||||
routes:
|
||||
- to: default
|
||||
via: 192.168.1.1
|
||||
version: 2
|
||||
```
|
||||
|
||||
save and close the file.
|
||||
|
||||
![Updated-Netplan-Config-File-Content-Ubuntu-Server][3]
|
||||
|
||||
In the above file we have used following,
|
||||
|
||||
* ens33 is the interface name
|
||||
* addresses are used to set the static ip
|
||||
* nameservers used to specify the DNS server ips
|
||||
* routes used to specify the default gateway
|
||||
|
||||
Note: Change the IP details and interface name as per your environment.
|
||||
|
||||
To make above changes into the effect the apply these changes using following netplan command,
|
||||
|
||||
```
|
||||
$ sudo netplan apply
|
||||
```
|
||||
|
||||
Run following ip command to view the ip address on interface,
|
||||
|
||||
```
|
||||
$ ip addr show ens33
|
||||
```
|
||||
|
||||
To view the default route, run
|
||||
|
||||
```
|
||||
$ ip route show
|
||||
```
|
||||
|
||||
Output of above commands,
|
||||
|
||||
![ip-addr-route-command-output-ubuntu-server][4]
|
||||
|
||||
Perfect, above commands’ output confirms that static ip and route has been configured successfully.
|
||||
|
||||
That’s all from this post. Kindly do post your queries and feedback in below comments section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/static-ip-address-on-ubuntu-server/
|
||||
|
||||
作者:[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
|
||||
[1]: https://www.linuxtechi.com/configure-ip-with-nmcli-command-linux/
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2022/10/Default-Content-netplan-ubuntu-server.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2022/10/Updated-Netplan-Config-File-Content-Ubuntu-Server.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2022/10/ip-addr-route-command-output-ubuntu-server.png
|
@ -0,0 +1,88 @@
|
||||
[#]: subject: "Kubuntu 22.10 Kinetic Kudu: Top New Features"
|
||||
[#]: via: "https://www.debugpoint.com/kubuntu-22-10-features/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Kubuntu 22.10 Kinetic Kudu: Top New Features
|
||||
======
|
||||
A brief summary of Kubuntu 22.10 “Kinetic Kudu” and additional information about the release.
|
||||
|
||||
![Kubuntu 22.10 Kinetic Kudu Desktop][1]
|
||||
|
||||
### Kubuntu 22.10: Top New Features
|
||||
|
||||
Among all the [great KDE Plasma-based distributions][2], Kubuntu is the best. Because it brings stability to both Plasma and at its core, that is Ubuntu.
|
||||
|
||||
Kubuntu 22.10 is a short-term release based on Ubuntu 22.10 – supported for nine months from the release. Since short-term releases are to adopt the latest technologies, removing the obsolete ones, its features list is minimal.
|
||||
|
||||
This release of Kubuntu features Linux Kernel 5.19, which brings run-time Average Power Limiting (RAPL) support for Intel’s Raptor and Alder Lake processor, multiple families of ARM updates in mainline kernel and usual processor/GPU and file-system updates. Learn more about Kernel 5.19 features in [this article][3].
|
||||
|
||||
Compared to the prior [Kubuntu release 22.04 LTS][4] (with Plasma 5.24), you get the latest KDE Plasma 5.25 (final point release) desktop with all the bug fixes and updates.
|
||||
|
||||
Although, [KDE Plasma 5.26][5], which has just got released, could not make it to this version. But I believe it should come in as a point release, just not on the release day.
|
||||
|
||||
Besides, Plasma 5.25 is not small in terms of features. It’s, in fact, packed with new cool advancements. If you are especially using Kubuntu’s earlier version, you should be aware of these new items.
|
||||
|
||||
Firstly, Kubuntu 22.10 enables you to make your default panel “float”. We call it the Floating Panel. So, no more using the add-ons for this.
|
||||
|
||||
Secondly, the accent colour of your desktop can change based on the wallpaper’s tone. Now you can see your Kubuntu desktop changes dynamically when you enable it from Settings > Global Theme > Colours.
|
||||
|
||||
![KDE Plasma - Dynamic Accent Colour and Floating Panel Demo][6]
|
||||
|
||||
In addition, switching between dark and light modes becomes more smooth thanks to the change. Also, in Kubuntu 22.10 with Wayland, you can now see and apply the display-specific resolutions in the settings dropdown.
|
||||
|
||||
On the other hand, Discover is more friendly to Flatpak, with additional app details and an additional options button to notify you that there is still data for uninstalled apps.
|
||||
|
||||
![The app page gives more clarity in Plasma 5.25][7]
|
||||
|
||||
Furthermore, the Krunner launcher in Kubuntu now detects the search language and display results accordingly. Also, the network manager applet now shows the Wi-Fi frequency alongside the access point name (this is help full for cases where you have the same access point name for 4G and 5G bands).
|
||||
|
||||
All of these changes are powered by Qt 5.15.6 and Framework 5.98. If you want to learn more about Plasma 5.25, refer to the dedicated feature guide [here][8].
|
||||
|
||||
### Other features of Kubuntu 22.10
|
||||
|
||||
The core applications and packages bump up to their respective versions based on Ubuntu 22.10, and here’s a summary.
|
||||
|
||||
* Linux Kernel 5.19
|
||||
* KDE Plasma 5.25.5 (hopefully will get 5.26 soon)
|
||||
* KDE Framework 5.98
|
||||
* Qt 5.15.6
|
||||
* Firefox 105.0.1
|
||||
* Thunderbird 102.3.2
|
||||
* LibreOffice 7.4.2.3
|
||||
* VLC Media Player 3.0.17
|
||||
* Pipewire replacing PulseAudio
|
||||
|
||||
Finally, you can download the Kubuntu 22.10 BETA from the below links.
|
||||
|
||||
[https://cdimage.ubuntu.com/kubuntu/releases/kinetic/beta/][9]
|
||||
|
||||
While the developers are preparing for the final release (due on Oct 20, 2022), you can try it on a [virtual machine][10], Or a physical system.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/kubuntu-22-10-features/
|
||||
|
||||
作者:[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/wp-content/uploads/2022/10/Kubuntu-22.10-Kinetic-Kudu-Desktop.jpg
|
||||
[2]: https://www.debugpoint.com/top-linux-distributions-kde-plasma/
|
||||
[3]: https://www.debugpoint.com/linux-kernel-5-19/
|
||||
[4]: https://www.debugpoint.com/kubuntu-22-04-lts/
|
||||
[5]: https://www.debugpoint.com/kde-plasma-5-26/
|
||||
[6]: https://youtu.be/npfHwMLXXHs
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/05/App-page-gives-more-clarity-in-Plasma-5.25.jpg
|
||||
[8]: https://www.debugpoint.com/kde-plasma-5-25/
|
||||
[9]: https://cdimage.ubuntu.com/kubuntu/releases/kinetic/beta/
|
||||
[10]: https://www.debugpoint.com/tag/virtual-machine
|
190
sources/tech/20221013 Asynchronous programming in Rust.md
Normal file
190
sources/tech/20221013 Asynchronous programming in Rust.md
Normal file
@ -0,0 +1,190 @@
|
||||
[#]: subject: "Asynchronous programming in Rust"
|
||||
[#]: via: "https://opensource.com/article/22/10/asynchronous-programming-rust"
|
||||
[#]: author: "Stephan Avenwedde https://opensource.com/users/hansic99"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Asynchronous programming in Rust
|
||||
======
|
||||
Take a look at how async-await works in Rust.
|
||||
|
||||
![Ferris the crab under the sea, unofficial logo for Rust programming language][1]
|
||||
|
||||
Image by: Opensource.com
|
||||
|
||||
Asynchronous programming: Incredibly useful but difficult to learn. You can't avoid async programming to create a fast and reactive application. Applications with a high amount of file or network I/O or with a GUI that should always be reactive benefit tremendously from async programming. Tasks can be executed in the background while the user still makes inputs. Async programming is possible in many languages, each with different styles and syntax. [Rust][2] is no exception. In Rust, this feature is called *async-await*.
|
||||
|
||||
While *async-await* has been an integral part of Rust since version 1.39.0, most applications depend on community crates. In Rust, except for a larger binary, *async-await* comes with zero costs. This article gives you an insight into asynchronous programming in Rust.
|
||||
|
||||
### Under the hood
|
||||
|
||||
To get a basic understanding of *async-await* in Rust, you literally start in the middle.
|
||||
|
||||
The center of *async-await* is the [future][3] trait, which declares the method *poll* (I cover this in more detail below). If a value can be computed asynchronously, the related type should implement the *future* trait. The *poll* method is called repeatedly until the final value is available.
|
||||
|
||||
At this point, you could repeatedly call the *poll* method from your synchronous application manually in order to get the final value. However, since I'm talking about asynchronous programming, you can hand over this task to another component: the runtime. So before you can make use of the *async* syntax, a runtime must be present. I use the runtime from the [tokio][4] community crate in the following examples.
|
||||
|
||||
A handy way of making the tokio runtime available is to use the `#[tokio::main]` macro on your main function:
|
||||
|
||||
```
|
||||
#[tokio::main]
|
||||
async fn main(){
|
||||
println!("Start!");
|
||||
sleep(Duration::from_secs(1)).await;
|
||||
println!("End after 1 second");
|
||||
}
|
||||
```
|
||||
|
||||
When the runtime is available, you can now *await* futures. Awaiting means that further executions stop here as long as the *future* needs to be completed. The *await* method causes the runtime to invoke the *poll* method, which will drive the *future* to completion.
|
||||
|
||||
In the above example, the tokios [sleep][5] function returns a *future* that finishes when the specified duration has passed. By awaiting this future, the related *poll* method is repeatedly called until the *future* completes. Furthermore, the *main()* function also returns a *future* because of the `async` keyword before the **fn**.
|
||||
|
||||
So if you see a function marked with `async`**:**
|
||||
|
||||
```
|
||||
async fn foo() -> usize { /**/ }
|
||||
```
|
||||
|
||||
Then it is just syntactic sugar for:
|
||||
|
||||
```
|
||||
fn foo() -> impl Future<Output = usize> { async { /**/ } }
|
||||
```
|
||||
|
||||
### Pinning and boxing
|
||||
|
||||
To remove some of the shrouds and clouds of *async-await* in Rust, you must understand *pinning* and *boxing*.
|
||||
|
||||
If you are dealing with *async-await*, you will relatively quickly step over the terms boxing and pinning. Since I find that the available explanations on the subject are rather difficult to understand, I have set myself the goal of explaining the issue more easily.
|
||||
|
||||
Sometimes it is necessary to have objects that are guaranteed not to be moved in memory. This comes into effect when you have a self-referential type:
|
||||
|
||||
```
|
||||
struct MustBePinned {
|
||||
a: int16,
|
||||
b: &int16
|
||||
}
|
||||
```
|
||||
|
||||
If member **b** is a reference (pointer) to member **a** of the same instance, then reference **b** becomes invalid when the instance is moved because the location of member **a** has changed but **b** still points to the previous location. You can find a more comprehensive example of a *self-referential* type in the [Rust Async book][6]. All you need to know now is that an instance of *MustBePinned* should not be moved in memory. Types like *MustBePinned* do not implement the *Unpin* trait, which would allow them to move within memory safely. In other words, *MustBePinned* is *!Unpin*.
|
||||
|
||||
Back to the future: By default, a *future* is also *!Unpin*; thus, it should not be moved in memory. So how do you handle those types? You pin and box them.
|
||||
|
||||
The [Pin<T>][7] type wraps pointer types, guaranteeing that the values behind the pointer won't be moved. The **Pin<T>** type ensures this by not providing a mutable reference of the wrapped type. The type will be pinned for the lifetime of the object. If you accidentally pin a type that implements *Unpin* (which is safe to move), it won't have any effect.
|
||||
|
||||
In practice: If you want to return a *future* (*!Unpin*) from a function, you must box it. Using [Box<T>][8] causes the type to be allocated on the heap instead of the stack and thus ensures that it can outlive the current function without being moved. In particular, if you want to hand over a *future*, you can only hand over a pointer to it as the *future* must be of type **Pin<Box<dyn Future>>**.
|
||||
|
||||
Using *async-wait*, you will certainly stumble upon this boxing and pinning syntax. To wrap this topic up, you just have to remember this:
|
||||
|
||||
* Rust does not know whether a type can be safely moved.
|
||||
* Types that shouldn't be moved must be wrapped inside [Pin<T>][9].
|
||||
* Most types are [Unpin][10]ned types. They implement the trait Unpin and can be freely moved within memory.
|
||||
* If a type is wrapped inside [Pin<T>][11] and the wrapped type is !Unpin, it is not possible to get a mutable reference out of it.
|
||||
* Futures created by the async keyword are !Unpin and thus must be pinned.
|
||||
|
||||
### Future trait
|
||||
|
||||
In the [future][12] trait, everything comes together:
|
||||
|
||||
```
|
||||
pub trait Future {
|
||||
type Output;
|
||||
|
||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
|
||||
}
|
||||
```
|
||||
|
||||
Here is a simple example of how to implement the *future* trait:
|
||||
|
||||
```
|
||||
struct MyCounterFuture {
|
||||
cnt : u32,
|
||||
cnt_final : u32
|
||||
}
|
||||
|
||||
impl MyCounterFuture {
|
||||
pub fn new(final_value : u32) -> Self {
|
||||
Self {
|
||||
cnt : 0,
|
||||
cnt_final : final_value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Future for MyCounterFuture {
|
||||
type Output = u32;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<u32>{
|
||||
self.cnt += 1;
|
||||
if self.cnt >= self.cnt_final {
|
||||
println!("Counting finished");
|
||||
return Poll::Ready(self.cnt_final);
|
||||
}
|
||||
|
||||
cx.waker().wake_by_ref();
|
||||
Poll::Pending
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main(){
|
||||
let my_counter = MyCounterFuture::new(42);
|
||||
|
||||
let final_value = my_counter.await;
|
||||
println!("Final value: {}", final_value);
|
||||
}
|
||||
```
|
||||
|
||||
Here is a simple example of how the *future* trait is implemented manually: The *future* is initialized with a value to which it shall count, stored in **cnt_final**. Each time the *poll* method is invoked, the internal value **cnt** gets incremented by one. If **cnt** is less than **cnt_final**, the future signals the [waker][13] of the runtime that the *future* is ready to be polled again. The return value of `Poll::Pending` signals that the *future* has not completed yet. After **cnt** is *>=* **cnt_final**, the *poll* function returns with `Poll::Ready`, signaling that the *future* has completed and providing the final value.
|
||||
|
||||
This is just a simple example, and of course, there are other things to take care of. If you consider creating your own futures, I highly suggest reading the chapter [Async in depth][14] in the documentation of the tokio crate.
|
||||
|
||||
### Wrap up
|
||||
|
||||
Before I wrap things up, here is some additional information that I consider useful:
|
||||
|
||||
* Create a new pinned and boxed type using [Box::pin][15].
|
||||
* The [futures][16] crate provides the type [BoxFuture][17] which lets you define a future as return type of a function.
|
||||
* The [async_trait][18] allows you to define an async function in traits (which is currently not allowed).
|
||||
* The [pin-utils][19] crate provides macros to pin values.
|
||||
* The tokios [try_join!][20] macro (a)waits on multiple futures which return a [Result<T, E>][21].
|
||||
|
||||
Once the first hurdles have been overcome, async programming in Rust is straightforward. You don't even have to implement the *future* trait in your own types if you can outsource code that can be executed in parallel in an async function. In Rust, single-threaded and multi-threaded runtimes are available, so you can benefit from async programming even in embedded environments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/asynchronous-programming-rust
|
||||
|
||||
作者:[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/rust_programming_crab_sea.png
|
||||
[2]: https://opensource.com/article/20/12/learn-rust
|
||||
[3]: https://doc.rust-lang.org/std/future/trait.Future.html
|
||||
[4]: https://tokio.rs/
|
||||
[5]: https://docs.rs/tokio/latest/tokio/time/fn.sleep.html
|
||||
[6]: https://rust-lang.github.io/async-book/04_pinning/01_chapter.html
|
||||
[7]: https://doc.rust-lang.org/std/pin/struct.Pin.html
|
||||
[8]: https://doc.rust-lang.org/std/boxed/struct.Box.html
|
||||
[9]: https://doc.rust-lang.org/std/pin/struct.Pin.html
|
||||
[10]: https://doc.rust-lang.org/std/marker/trait.Unpin.html#
|
||||
[11]: https://doc.rust-lang.org/std/pin/struct.Pin.html
|
||||
[12]: https://doc.rust-lang.org/std/future/trait.Future.html
|
||||
[13]: https://tokio.rs/tokio/tutorial/async#wakers
|
||||
[14]: https://tokio.rs/tokio/tutorial/async
|
||||
[15]: https://doc.rust-lang.org/std/boxed/struct.Box.html#method.pin
|
||||
[16]: https://crates.io/crates/futures
|
||||
[17]: https://docs.rs/futures/latest/futures/future/type.BoxFuture.html
|
||||
[18]: https://docs.rs/async-trait/latest/async_trait/
|
||||
[19]: https://crates.io/crates/pin-utils
|
||||
[20]: https://docs.rs/tokio/latest/tokio/macro.try_join.html
|
||||
[21]: https://doc.rust-lang.org/std/result/
|
@ -0,0 +1,100 @@
|
||||
[#]: subject: "Enjoy the Classic Snake Game in Your Linux Terminal"
|
||||
[#]: via: "https://www.debugpoint.com/snake-game-linux-terminal/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Enjoy the Classic Snake Game in Your Linux Terminal
|
||||
======
|
||||
This is how you can install and play the classic Snake Game in Linux Terminal.
|
||||
|
||||
Remember the classic and simple snake game of old mobile phones? I remember playing it for hours. Hey, no other options at the time, right? Smartphones were still not in the market. And all you have is this –
|
||||
|
||||
![Nokia 3310 with legacy snake game][1]
|
||||
|
||||
But over time, the Snake Game was replaced by more advanced graphical games with various options. But nothing beats that classic snake game.
|
||||
|
||||
And what if I told you, you could play this game in the Linux Terminal itself? Whether you are running Ubuntu Linux, Fedora Linux or Arch Linux doesn’t matter. This game is available for most of the [distros][2].
|
||||
|
||||
![nsnake Game - Main Menu][3]
|
||||
|
||||
### Install nSnake – Snake Game for Linux Terminal
|
||||
|
||||
You can install [this game][4] via the terminal using the below methods.
|
||||
|
||||
For Ubuntu, Linux Mint or other related distributions:
|
||||
|
||||
```
|
||||
sudo apt install nsnake
|
||||
```
|
||||
|
||||
For Fedora Linux and others:
|
||||
|
||||
```
|
||||
sudo dnf install nsnake
|
||||
```
|
||||
|
||||
For Arch Linux, this snake game is available in the [Arch User repository][5]. You can install it using the following steps.
|
||||
|
||||
* [Set up Yay AUR helper][6]
|
||||
* Then open a terminal and run the below command
|
||||
|
||||
```
|
||||
yay -S nsnake
|
||||
```
|
||||
|
||||
The above command installs the stock repository version of the game, which might not be the latest. However, if you want the latest version, you may need to compile the source via GitHub. I have added the compilation instructions at the end of this page for your reference.
|
||||
|
||||
### Playing the game
|
||||
|
||||
Playing the game is very simple. Type nsnake in the terminal, which will launch the game.
|
||||
|
||||
To quit immediately, press q.
|
||||
|
||||
Following are the default key bindings.
|
||||
|
||||
* Arrow keys – to move the snake
|
||||
* q – Quit the game
|
||||
* p – Pause the game
|
||||
|
||||
You can also configure the game in various ways, which are available via the main menu.
|
||||
|
||||
![nsnake Linux Terminal Snake Game Settings][7]
|
||||
|
||||
So, enjoy!
|
||||
|
||||
##### Compilation
|
||||
|
||||
To compile the latest version, use the following commands in all Linux distributions.
|
||||
|
||||
Oh, make sure you have `git` and `ncurses-devel` installed, which are the required packages for compilation.
|
||||
|
||||
```
|
||||
git clone https://github.com/alexdantas/nSnake.gitcd nsnakemakemake install
|
||||
```
|
||||
|
||||
So, do you like Snake Game? Do you prefer it over other terminal-based games? Share your views with other readers in the comment box below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/snake-game-linux-terminal/
|
||||
|
||||
作者:[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/wp-content/uploads/2021/12/Nokia-3310-with-legacy-snake-game.jpg
|
||||
[2]: https://www.debugpoint.com/category/distributions
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/12/nsnake-Game-Main-Menu.jpg
|
||||
[4]: https://github.com/alexdantas/nsnake
|
||||
[5]: https://aur.archlinux.org/packages/nsnake/
|
||||
[6]: https://www.debugpoint.com/2021/01/install-yay-arch/
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2021/12/nsnake-Linux-Terminal-Snake-Game-Settings.jpg
|
479
sources/tech/20221013 How To Monitor User Activity In Linux.md
Normal file
479
sources/tech/20221013 How To Monitor User Activity In Linux.md
Normal file
@ -0,0 +1,479 @@
|
||||
[#]: subject: "How To Monitor User Activity In Linux"
|
||||
[#]: via: "https://ostechnix.com/monitor-user-activity-linux/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How To Monitor User Activity In Linux
|
||||
======
|
||||
As a Linux administrator, you need to keep track of all users' activities. When something goes wrong in the server, you can analyze and investigate the users' activities, and try to find the root cause of the problem. There are many ways to **monitor users in Linux**. In this guide, we are going to talk about **GNU accounting utilities** that can be used to **monitor the user activity in Linux**.
|
||||
|
||||
### What are Accounting utilities?
|
||||
|
||||
The Accounting utilities provides the useful information about system usage, such as connections, programs executed, and utilization of system resources in Linux. These accounting utilities can be installed using **psacct** or **acct** package.
|
||||
|
||||
The psacct or acct are same. In RPM-based systems, it is available as psacct, and in DEB-based systems, it is available as acct.
|
||||
|
||||
What is the use of psacct or acct utilities? You might wonder. Generally, the user's command line history details will be stored in **.bash_history** file in their $HOME directory. Some users might try to edit, modify or delete the history.
|
||||
|
||||
However, the accounting utilities will still be able to retrieve the users activities even though they [cleared their command line history][1] completely. Because, **all process accounting files are owned by root** user, and the normal users can't edit them.
|
||||
|
||||
### Install psacct or acct in Linux
|
||||
|
||||
The psacct/acct utilities are packaged for popular Linux distributions.
|
||||
|
||||
To install psacct in Alpine Linux, run:
|
||||
|
||||
```
|
||||
$ sudo apk add psacct
|
||||
```
|
||||
|
||||
To install acct in Arch Linux and its variants like EndeavourOS and Manjaro Linux, run:
|
||||
|
||||
```
|
||||
$ sudo pacman -S acct
|
||||
```
|
||||
|
||||
On Fedora, RHEL, and its clones like CentOS, AlmaLinux and Rocky Linux, run the following command to install psacct:
|
||||
|
||||
```
|
||||
$ sudo dnf install psacct
|
||||
```
|
||||
|
||||
In RHEL 6 and older versions, you should use `yum` instead of `dnf` to install psacct.
|
||||
|
||||
```
|
||||
$ sudo yum install psacct
|
||||
```
|
||||
|
||||
On Debian, Ubuntu, Linux Mint, install acct using command:
|
||||
|
||||
```
|
||||
$ sudo apt install acct
|
||||
```
|
||||
|
||||
To install acct on openSUSE, run:
|
||||
|
||||
```
|
||||
$ sudo zypper install acct
|
||||
```
|
||||
|
||||
### Start psacct/acct service
|
||||
|
||||
To enable and start the psacct service, run:
|
||||
|
||||
```
|
||||
$ sudo systemctl enable psacct
|
||||
```
|
||||
|
||||
```
|
||||
$ sudo systemctl start psacct
|
||||
```
|
||||
|
||||
To check if psacct service is loaded and active, run:
|
||||
|
||||
```
|
||||
$ sudo systemctl status psacct
|
||||
```
|
||||
|
||||
On DEB-based systems, the acct service will be automatically started after installing it.
|
||||
|
||||
You can verify whether acct service is started or not using command:
|
||||
|
||||
```
|
||||
$ sudo systemctl status acct
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
● acct.service - Kernel process accounting
|
||||
Loaded: loaded (/lib/systemd/system/acct.service; enabled; vendor preset: enabled)
|
||||
Active: active (exited) since Thu 2022-10-13 16:06:35 IST; 28s ago
|
||||
Docs: man:accton(8)
|
||||
Process: 3241 ExecStart=/usr/sbin/accton /var/log/account/pacct (code=exited, status=0/SUCCESS)
|
||||
Main PID: 3241 (code=exited, status=0/SUCCESS)
|
||||
CPU: 879us
|
||||
|
||||
Oct 13 16:06:35 ubuntu2204 systemd[1]: Starting Kernel process accounting...
|
||||
Oct 13 16:06:35 ubuntu2204 accton[3241]: Turning on process accounting, file set to '/var/log/account/pacct'.
|
||||
Oct 13 16:06:35 ubuntu2204 systemd[1]: Finished Kernel process accounting.
|
||||
```
|
||||
|
||||
> **Download** - [Free eBook: "Nagios Monitoring Handbook"][2]
|
||||
|
||||
### Monitor User Activity in Linux using psacct or acct
|
||||
|
||||
The psacct (Process accounting) package contains following useful utilities to monitor the user and process activities.
|
||||
|
||||
* ac - Displays statistics about how long users have been logged on.
|
||||
* lastcomm - Displays information about previously executed commands.
|
||||
* accton - Turns process accounting on or off.
|
||||
* dump-acct - Transforms the output file from the accton format to a human-readable format.
|
||||
* dump-utmp - Prints utmp files in human-readable format.
|
||||
* sa - Summarizes information about previously executed commands.
|
||||
|
||||
Let us learn how to monitor the activities of Linux users by using each utility with examples.
|
||||
|
||||
#### 1. The ac command examples
|
||||
|
||||
The **ac** utility will display the report of connect time in hours. It can tell you how long a user or group of users were connected to the system.
|
||||
|
||||
##### 1.1. Display total connect time of all users
|
||||
|
||||
```
|
||||
$ ac
|
||||
```
|
||||
|
||||
This command displays the total connect time of all users in hours.
|
||||
|
||||
```
|
||||
total 52.91
|
||||
```
|
||||
|
||||
![Display total connect time of all users][3]
|
||||
|
||||
##### 1.2. Show total connect of all users by day-wise
|
||||
|
||||
You can sort this result by day-wise by using **-d** flag as shown below.
|
||||
|
||||
```
|
||||
$ ac -d
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
May 11 total 4.29
|
||||
May 13 total 3.23
|
||||
May 14 total 7.66
|
||||
May 15 total 8.97
|
||||
May 16 total 0.52
|
||||
May 20 total 4.09
|
||||
May 24 total 1.32
|
||||
Jun 9 total 15.18
|
||||
Jun 10 total 2.97
|
||||
Jun 22 total 2.61
|
||||
Jul 19 total 1.95
|
||||
Today total 0.29
|
||||
```
|
||||
|
||||
![Show total connect of all users by day-wise][4]
|
||||
|
||||
##### 1.3. Get total connect time by user-wise
|
||||
|
||||
Also, you can display how long each user was connected with the system with **-p** flag.
|
||||
|
||||
```
|
||||
$ ac -p
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
ostechnix 52.85
|
||||
root 0.51
|
||||
total 53.36
|
||||
```
|
||||
|
||||
![Get total connect time by user-wise][5]
|
||||
|
||||
##### 1.4. Print total connect time of a specific user
|
||||
|
||||
And also, you can display the individual user's total login time as well.
|
||||
|
||||
```
|
||||
$ ac ostechnix
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
total 52.95
|
||||
```
|
||||
|
||||
##### 1.5. View total connect time of a certain user by day-wise
|
||||
|
||||
To display individual user's login time by day-wise, run:
|
||||
|
||||
```
|
||||
$ ac -d ostechnix
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
May 11 total 4.29
|
||||
May 13 total 3.23
|
||||
May 14 total 7.66
|
||||
May 15 total 8.97
|
||||
May 16 total 0.01
|
||||
May 20 total 4.09
|
||||
May 24 total 1.32
|
||||
Jun 9 total 15.18
|
||||
Jun 10 total 2.97
|
||||
Jun 22 total 2.61
|
||||
Jul 19 total 1.95
|
||||
Today total 0.68
|
||||
```
|
||||
|
||||
![View total connect time of a certain user by day-wise][6]
|
||||
|
||||
For more details, refer the man pages.
|
||||
|
||||
```
|
||||
$ man ac
|
||||
```
|
||||
|
||||
#### 2. The lastcomm command examples
|
||||
|
||||
The **lastcomm** utility displays the list of previously executed commands. The most recent executed commands will be listed first.
|
||||
|
||||
##### 2.1. Display previously executed commands
|
||||
|
||||
```
|
||||
$ lastcomm
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
systemd-hostnam S root __ 0.06 secs Thu Oct 13 17:21
|
||||
systemd-localed S root __ 0.06 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
awk ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
uname ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
sed ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
grep ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
grep ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
bash F ostechni pts/1 0.00 secs Thu Oct 13 17:22
|
||||
[...]
|
||||
```
|
||||
|
||||
##### 2.2. Print last executed commands of a specific user
|
||||
|
||||
The above command displays all user's commands. You can display the previously executed commands by a particular user using command:
|
||||
|
||||
```
|
||||
$ lastcomm ostechnix
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
less ostechni pts/1 0.00 secs Thu Oct 13 17:26
|
||||
lastcomm ostechni pts/1 0.00 secs Thu Oct 13 17:26
|
||||
lastcomm ostechni pts/1 0.00 secs Thu Oct 13 17:26
|
||||
lastcomm ostechni pts/1 0.00 secs Thu Oct 13 17:26
|
||||
gdbus X ostechni __ 0.00 secs Thu Oct 13 17:24
|
||||
lastcomm ostechni pts/1 0.00 secs Thu Oct 13 17:24
|
||||
ac ostechni pts/1 0.00 secs Thu Oct 13 17:24
|
||||
update-notifier F ostechni __ 0.00 secs Thu Oct 13 17:23
|
||||
apport-checkrep ostechni __ 0.06 secs Thu Oct 13 17:23
|
||||
apport-checkrep ostechni __ 0.05 secs Thu Oct 13 17:23
|
||||
systemctl ostechni __ 0.00 secs Thu Oct 13 17:23
|
||||
apt-check ostechni __ 0.81 secs Thu Oct 13 17:23
|
||||
dpkg ostechni __ 0.00 secs Thu Oct 13 17:23
|
||||
ischroot ostechni __ 0.00 secs Thu Oct 13 17:23
|
||||
dpkg ostechni __ 0.00 secs Thu Oct 13 17:23
|
||||
[...]
|
||||
```
|
||||
|
||||
##### 2.3. Print total number of command execution
|
||||
|
||||
Also, you can view how many times a particular command has been executed.
|
||||
|
||||
```
|
||||
$ lastcomm apt
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
apt S root pts/2 0.70 secs Thu Oct 13 16:06
|
||||
apt F root pts/2 0.00 secs Thu Oct 13 16:06
|
||||
apt F root pts/2 0.00 secs Thu Oct 13 16:06
|
||||
```
|
||||
|
||||
As you see in the above output, the `apt` command has been executed three times by `root` user.
|
||||
|
||||
For more details, refer the man pages.
|
||||
|
||||
```
|
||||
$ man lastcomm
|
||||
```
|
||||
|
||||
#### 3. The sa command examples
|
||||
|
||||
The sa utility will summarize the information about previously executed commands.
|
||||
|
||||
##### 3.1. Print summary of all commands
|
||||
|
||||
```
|
||||
$ sa
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
1522 1598.63re 0.23cp 0avio 32712k
|
||||
139 570.90re 0.05cp 0avio 36877k ***other*
|
||||
38 163.63re 0.05cp 0avio 111445k gdbus
|
||||
3 0.05re 0.04cp 0avio 12015k apt-check
|
||||
27 264.27re 0.02cp 0avio 0k kworker/dying*
|
||||
2 51.87re 0.01cp 0avio 5310464k Docker Desktop
|
||||
5 0.03re 0.01cp 0avio 785k snap-confine
|
||||
8 59.48re 0.01cp 0avio 85838k gmain
|
||||
5 103.94re 0.01cp 0avio 112720k dconf worker
|
||||
24 3.38re 0.00cp 0avio 2937k systemd-udevd*
|
||||
7 0.01re 0.00cp 0avio 36208k 5
|
||||
3 1.51re 0.00cp 0avio 3672k systemd-timedat
|
||||
2 0.00re 0.00cp 0avio 10236k apport-checkrep
|
||||
2 0.01re 0.00cp 0avio 4316160k ThreadPoolForeg*
|
||||
2 0.00re 0.00cp 0avio 8550k package-data-do
|
||||
3 0.79re 0.00cp 0avio 2156k dbus-daemon
|
||||
12 0.00re 0.00cp 0avio 39631k ffmpeg
|
||||
[...]
|
||||
```
|
||||
|
||||
##### 3.2. View number of processes and CPU minutes
|
||||
|
||||
To print the number of processes and number of CPU minutes on a per-user basis, run `sa` command with `-m` flag:
|
||||
|
||||
```
|
||||
$ sa -m
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
1525 1598.63re 0.23cp 0avio 32651k
|
||||
root 561 647.23re 0.09cp 0avio 3847k
|
||||
ostechnix 825 780.79re 0.08cp 0avio 47788k
|
||||
gdm 117 13.43re 0.06cp 0avio 63715k
|
||||
colord 2 52.01re 0.00cp 0avio 89720k
|
||||
geoclue 1 1.01re 0.00cp 0avio 70608k
|
||||
jellyfin 12 0.00re 0.00cp 0avio 39631k
|
||||
man 1 0.00re 0.00cp 0avio 3124k
|
||||
kernoops 4 104.12re 0.00cp 0avio 3270k
|
||||
sshd 1 0.05re 0.00cp 0avio 3856k
|
||||
whoopsie 1 0.00re 0.00cp 0avio 8552k
|
||||
```
|
||||
|
||||
##### 3.3. Print user id and command name
|
||||
|
||||
For each command in the accounting file, print the userid and command name using `-u` flag.
|
||||
|
||||
```
|
||||
$ sa -u
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
root 0.00 cpu 693k mem 0 io accton
|
||||
root 0.00 cpu 3668k mem 0 io systemd-tty-ask
|
||||
root 0.00 cpu 3260k mem 0 io systemctl
|
||||
root 0.01 cpu 3764k mem 0 io deb-systemd-inv
|
||||
root 0.00 cpu 722k mem 0 io acct.postinst
|
||||
root 0.00 cpu 704k mem 0 io rm
|
||||
root 0.00 cpu 939k mem 0 io cp
|
||||
root 0.00 cpu 704k mem 0 io rm
|
||||
root 0.00 cpu 951k mem 0 io find
|
||||
root 0.00 cpu 911k mem 0 io gzip
|
||||
root 0.00 cpu 722k mem 0 io sh
|
||||
root 0.00 cpu 748k mem 0 io install-info
|
||||
root 0.00 cpu 911k mem 0 io gzip
|
||||
[...]
|
||||
```
|
||||
|
||||
For more details, refer the man pages.
|
||||
|
||||
```
|
||||
$ man sa
|
||||
```
|
||||
|
||||
#### 4. The dump-acct and dump-utmp command examples
|
||||
|
||||
The **dump-acct** utility displays the output file from the accton format to a human-readable format.
|
||||
|
||||
```
|
||||
$ dump-acct /var/account/pacct
|
||||
```
|
||||
|
||||
dump-utmp displays utmp files in human-readable format.
|
||||
|
||||
```
|
||||
$ dump-utmp /var/run/utmp
|
||||
```
|
||||
|
||||
For more details, refer the man pages.
|
||||
|
||||
```
|
||||
$ man dump-acct
|
||||
```
|
||||
|
||||
```
|
||||
$ man dump-utmp
|
||||
```
|
||||
|
||||
#### 5. The accton command examples
|
||||
|
||||
The accton command will allow you to turn on or turn off accounting.
|
||||
|
||||
To turn on process accounting, run:
|
||||
|
||||
```
|
||||
$ accton on
|
||||
```
|
||||
|
||||
To turn it off, run:
|
||||
|
||||
```
|
||||
$ accton off
|
||||
```
|
||||
|
||||
For more details, refer the man pages.
|
||||
|
||||
```
|
||||
$ man accton
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
Every Linux administrator should be aware of GNU accounting utilities to keep an eye on all users. These utilities will be quite helpful in troubleshooting time.
|
||||
|
||||
**Resource:**
|
||||
|
||||
* [The GNU Accounting Utilities website][7]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/monitor-user-activity-linux/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/how-to-clear-command-line-history-in-linux/
|
||||
[2]: https://ostechnix.tradepub.com/free/w_syst04/prgm.cgi
|
||||
[3]: https://ostechnix.com/wp-content/uploads/2022/10/Display-total-connect-time-of-all-users.png
|
||||
[4]: https://ostechnix.com/wp-content/uploads/2022/10/Show-total-connect-of-all-users-by-day-wise.png
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/10/Get-total-connect-time-by-user-wise.png
|
||||
[6]: https://ostechnix.com/wp-content/uploads/2022/10/View-total-connect-time-of-a-certain-user-by-day-wise.png
|
||||
[7]: https://www.gnu.org/software/acct/manual/accounting.html
|
@ -0,0 +1,158 @@
|
||||
[#]: subject: "Learn Bash base64 Encode and Decode With Examples"
|
||||
[#]: via: "https://www.debugpoint.com/bash-base64-encode-decode/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Learn Bash base64 Encode and Decode With Examples
|
||||
======
|
||||
Want to learn about the base64 encode and decode method? Here in this tutorial, we explain the base64 encode and decode steps using bash shell scripting with various examples.
|
||||
|
||||
![][1]
|
||||
|
||||
The base64 encoding method transmits data over any communication medium by converting binary data to text. This method is primarily used for the email encryption process.
|
||||
|
||||
The Base64 method, in general, is a binary-to-text encoding scheme representing 8-byte binary data in ASCII string format. This has several advantages while transmitting or channelling data among various mediums – especially those that reliably support text content. Hence, it is widely used on World Wide Web. Probably the most used case of this encoding scheme is using it for email attachments.
|
||||
|
||||
As per the Base64 representation table, the binary data can be converted to 64 different ASCII characters – which are easy to transmit and printable. This encoding method uses letters A to Z, a to Z, 0 to 9 and + and /.
|
||||
|
||||
A total of 64 ASCII characters to represent binary from `000000` to `111111`. Each non-final Base64 digit represents exactly 6 bits of data.
|
||||
|
||||
![Base64 Index Table][2]
|
||||
|
||||
### Bash base64 encode and decode
|
||||
|
||||
#### Syntax
|
||||
|
||||
Before you learn about the examples, here is the basic syntax.
|
||||
|
||||
```
|
||||
base64 [OPTIONs] [INFILE] [OUTFILE]
|
||||
```
|
||||
|
||||
Option: You can provide any of the options or combine them as explained below.INFILE: Input can be picked up from standard input (like the command line) or files.OUTFILE: You can redirect the output to the standard output, like the terminal or to a file.
|
||||
|
||||
| Arguments | Descriptions |
|
||||
| :- | :- |
|
||||
| -e or –encode | This option is used to encode any data from standard input or any file. It is the default option. |
|
||||
| -d or –decode | This option is used to decode any encoded data from standard input or any file. |
|
||||
| -n or –noerrcheck | By default, base64 checks error while decoding any data. You can use –n or –noerrcheck option to ignore checking at the time of decoding. |
|
||||
| -i, –ignore-garbage | This option is used to ignore non-alphabet characters while decoding. |
|
||||
| -u or –help | This option is used to get information about the usage of this command. |
|
||||
|
||||
#### Example 1 – A basic encode
|
||||
|
||||
In Linux, the base64 package is installed by default. Hence, you can use it from the command line easily. To simply encode a string or text, you can pass it through the command line via piping and get the encoded text. In this example, the string debugpoint.com is encoded to base64.
|
||||
|
||||
```
|
||||
echo "debugpoint.com" | base64
|
||||
```
|
||||
|
||||
![bash base64 encode and decode - example 1][3]
|
||||
|
||||
The result is the base64 encoded string.
|
||||
|
||||
#### Explanation
|
||||
|
||||
The encoding method uses several steps to convert the input. The input characters are converted to 8-bit binary values. The entire set of the binary string is split into 6-bit binary values, which are converted to decimals.
|
||||
|
||||
Each decimal value is translated to the base64 character via the base64 index table.
|
||||
|
||||
In the above example, the first character, “d”, is converted to binary `01100100`. The first 6 bits are `011001`, which is 25 in decimal. The 25 refers to the Z in the base64 index table. And this goes on for the entire stream of text. See the example below.
|
||||
|
||||
![Base64 Encode and Decode – inner working][4]
|
||||
|
||||
#### Example 2 – A basic decode
|
||||
|
||||
To decode the string, simply pass the encoded value to the base64 with the option `--decode`. And it will give you the exact input string.
|
||||
|
||||
![bash base64 encode and decode - example 2 (decode the same example)][5]
|
||||
|
||||
#### Example 3 – Encode a Text file
|
||||
|
||||
The same command can be used to encode a text file and redirect the output to another text file. Here’s how.
|
||||
|
||||
```
|
||||
base64 example3.txt > example3-encoded.txt
|
||||
```
|
||||
|
||||
![Encode a text file][6]
|
||||
|
||||
#### Example 4 – Decode a Text File
|
||||
|
||||
And to decode a text file that was encoded using base64, simply use the `--decode` or `-d` switch and pass on the text file name.
|
||||
|
||||
```
|
||||
base64 -d example3-encoded.txt
|
||||
```
|
||||
|
||||
#### Example 5 – Encode a custom input from the user
|
||||
|
||||
Using bash shell programming, you can take input from the user via the terminal and encode it. But for that, you need to write a simple shell script and execute it after giving executable permission.
|
||||
|
||||
Here’s a simple example which takes input from the user and displays the encoded string.
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
#Sample program to take input, encode to base64 and display on terminal
|
||||
#Example by www.debugpoint.com
|
||||
echo "Enter text for encoding to base64:"
|
||||
read input_text
|
||||
output_text=`echo -n $input_text | base64`
|
||||
echo "The Base64 Encoded text is: $output_text"
|
||||
```
|
||||
|
||||
![Custom input - base64 encode and decode using script][7]
|
||||
|
||||
#### Example 6 – A Simple Authentication using base64
|
||||
|
||||
You can implement a simple authentication system using the above encode and decode method. You can ask the user to enter a password or a secret code. Then store the secret code in a file or compare it on the fly.
|
||||
|
||||
If the stored encoded string matches with the user input encoded text, then the user is authenticated. However, it is a straightforward way of checking an authentication, but sometimes useful for simple business cases.
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
#Sample program to take input, encode to base64 and display on terminal
|
||||
#Example by www.debugpoint.com
|
||||
echo "Type your password"
|
||||
read pwd1
|
||||
decoded_text=`echo 'U2lsZW5jZSBpcyBnb2xkZW4h' | base64 --decode`
|
||||
if [[ $pwd1 == $decoded_text ]]
|
||||
then
|
||||
echo "You are a valid user."
|
||||
else
|
||||
echo "You are NOT a valid user."
|
||||
fi
|
||||
```
|
||||
|
||||
![A Simple Authentication using bash base64][8]
|
||||
|
||||
### Conclusion
|
||||
|
||||
I hope you get to learn the basics of [Base64][9] encode and decode with these examples. Also, learn a bit about its inner workings. Let me know in the comment box below if this helps you or need additional tutorials on this topic.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/bash-base64-encode-decode/
|
||||
|
||||
作者:[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/wp-content/uploads/2021/11/base64example-1024x576.jpg
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2021/11/Base64-Index-Table.png
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/11/bash-base64-encode-and-decode-example-1.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2021/11/Base64-Encode-and-Decode-inner-working.png
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2021/11/bash-base64-encode-and-decode-example-2-decode-the-same-example.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2021/11/Encode-a-text-file.png
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2021/11/Custom-input-base64-encode-and-decode-using-script.png
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2021/11/A-Simple-Authentication-using-bash-base64.png
|
||||
[9]: https://linux.die.net/man/1/base64
|
@ -0,0 +1,93 @@
|
||||
[#]: subject: "Ubuntu Budgie 22.10 Kinetic Kudu: Top New Features"
|
||||
[#]: via: "https://www.debugpoint.com/ubuntu-budgie-22-10-features/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Ubuntu Budgie 22.10 Kinetic Kudu: Top New Features
|
||||
======
|
||||
Here’s a brief overview of the Ubuntu Budgie 22.10 (upcoming) and its features.
|
||||
|
||||
![Ubuntu Budgie 22.10 KInetic Kudu Desktop][1]
|
||||
|
||||
### Ubuntu Budgie 22.10: Top New Features
|
||||
|
||||
The Budgie desktop has a different fan base because of its fusion of simplicity, feature and performance. Ubuntu Budgie 22.10 is an official Budgie flavour of Ubuntu, where you get the latest Ubuntu base with a stable Budgie desktop.
|
||||
|
||||
Ubuntu Budgie 22.10 is a short-term release, supported for nine months until July 2023.
|
||||
|
||||
This release of Ubuntu Budgie features Linux Kernel 5.19, which brings run-time Average Power Limiting (RAPL) support for Intel’s Raptor and Alder Lake processor, multiple families of ARM updates in mainline kernel and usual processor/GPU and file-system updates. Learn more about Kernel 5.19 features in [this article][2].
|
||||
|
||||
At the heart of this version, Ubuntu Budgie is powered by Budgie Desktop version 10.6.4, which brings updated applications and additional core tweaks. If you are using the prior Ubuntu budgie version, i.e. 22.04 or 21.10, you will notice some changes. And you should be aware of those.
|
||||
|
||||
First of all, the Budgie Control Center gets modern protocols for screensharing (both RDP and VNC), enhanced fractional scaling and colour profile support for your monitor. In addition, the Control centre now shows the monitor refresh rate and additional support added for Wacom tablets.
|
||||
|
||||
Secondly, Budgie desktop settings get a global option to control applets spacing and additional refinements.
|
||||
|
||||
After removing the calendar launcher, the clock at the top bar now only gives the launcher for date/time settings. You can access the Calendar from the applets at the extreme right of the top bar.
|
||||
|
||||
Ubuntu Budgie 22.10 fundamentally changed its application stack, which ships by default. Earlier (22.04 and prior), Budgie featured the GNOME applications as default for several desktop functions. Since GNOME is already moved to libadwaita/GTK4 with its own styling and theming, those apps wouldn’t look consistent in Budgie’s styling.
|
||||
|
||||
That is correct. Because these rounded corners with budgie/mate apps really look off.
|
||||
|
||||
![Budgie desktop with GTK4-libadwaita and MATE apps][3]
|
||||
|
||||
So, from this release onwards, the default app sets are slowly moving away from GNOME Apps to native or MATE apps/alternatives.
|
||||
|
||||
For Example, GNOME Calculator and System Monitor are now replaced by Mate Calculator and Mate system monitor. Atril document viewer replaces Evince reader. In addition, font-manager replaces GNOME Font Viewer, and a list of other GNOME apps are in “wait and watch” mode. They may get replaced in upcoming Budgie desktop point releases.
|
||||
|
||||
However, the text editor is still Gedit in this version, which is already a [great choice][4]. And a new native screenshot application debuts with a tweak tool for Raspberry Pi devices.
|
||||
|
||||
If you want to learn more about this transition, read the discussion [here][5].
|
||||
|
||||
So, that’s about the core changes in this release and here’s a quick summary of Ubuntu Budgie alongside other applications.
|
||||
|
||||
### Summary of the core items of Ubuntu Budgie 22.10
|
||||
|
||||
#### Core and major items
|
||||
|
||||
* [Ubuntu 22.10][6]
|
||||
* Linux Kernel 5.19
|
||||
* Budgie desktop version 10.6.4
|
||||
* Firefox 105.0.1 (Snap version)
|
||||
* Thunderbird 102.3.2
|
||||
* LibreOffice 7.4.2.3
|
||||
|
||||
#### Other changes
|
||||
|
||||
* Pipewire replacing PulseAudio. The PulseAudio package is removed from ISO.
|
||||
* WebP support by default
|
||||
* New Tweak Tool for ARM devices (Raspberry Pi)
|
||||
* Tilix Terminal 1.9.5
|
||||
* Transmission torrent client 3.0.0
|
||||
* GNOME Software 43.0
|
||||
|
||||
Finally, you can download Ubuntu Budgie 22.10 Beta from the below link. Also you can try out the Raspberry Pi beta image as well.
|
||||
|
||||
* [Link to the beta build][7]
|
||||
* [Link to Raspberry Pi build][8]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/ubuntu-budgie-22-10-features/
|
||||
|
||||
作者:[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/wp-content/uploads/2022/10/Ubuntu-Budgie-22.10-KInetic-Kudu-Desktop-1024x578.jpg
|
||||
[2]: https://www.debugpoint.com/linux-kernel-5-19/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/10/Budgie-desktop-with-GTK4-libadwaita-and-MATE-apps.jpg
|
||||
[4]: https://www.debugpoint.com/gedit-features/
|
||||
[5]: https://discourse.ubuntubudgie.org/t/default-applications-review-for-22-10-23-04-and-beyond/5883
|
||||
[6]: https://www.debugpoint.com/ubuntu-22-10/
|
||||
[7]: https://cdimage.ubuntu.com/ubuntu-budgie/releases/kinetic/beta/
|
||||
[8]: https://sourceforge.net/projects/budgie-remix/files/budgie-raspi-22.10/
|
@ -0,0 +1,102 @@
|
||||
[#]: subject: "What you need to know about compiling code"
|
||||
[#]: via: "https://opensource.com/article/22/10/compiling-code"
|
||||
[#]: author: "Alan Smithee https://opensource.com/users/alansmithee"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
What you need to know about compiling code
|
||||
======
|
||||
Use this handy mousetrap analogy to understand compiling code. Then download our new eBook, An open source developer's guide to building applications.
|
||||
|
||||
Source code must be compiled in order to run, and in open source software everyone has access to source code. Whether you've written code yourself and you want to compile and run it, or whether you've downloaded somebody's project to try it out, it's useful to know how to process source code through a [compiler][2], and also what exactly a compiler does with all that code.
|
||||
|
||||
### Build a better mousetrap
|
||||
|
||||
We don't usually think of a mousetrap as a computer, but believe it or not, it does share some similarities with the CPU running the device you're reading this article on. The classic (non-cat) mousetrap has two states: it's either set or released. You might consider that *on* (the kill bar is set and stores potential energy) and *off* (the kill bar has been triggered.) In a sense, a mousetrap is a computer that calculates the presence of a mouse. You might imagine this code, in an imaginary language, describing the process:
|
||||
|
||||
```
|
||||
if mousetrap == 0 then
|
||||
There's a mouse!
|
||||
else
|
||||
There's no mouse yet.
|
||||
end
|
||||
```
|
||||
|
||||
In other words, you can derive mouse data based on the state of a mousetrap. The mousetrap isn't foolproof, of course. There could be a mouse next to the mousetrap, and the mousetrap would still be registered as *on* because the mouse has not yet triggered the trap. So the program could use a few enhancements, but that's pretty typical.
|
||||
|
||||
### Switches
|
||||
|
||||
A mousetrap is ultimately a switch. You probably use a switch to turn on the lights in your house. A lot of information is stored in these mechanisms. For instance, people often assume that you're at home when the lights are on.
|
||||
|
||||
You could program actions based on the activity of lights on in your neighborhood. If all lights are out, then turn down your loud music because people have probably gone to bed.
|
||||
|
||||
A CPU uses the same logic, multiplied by several orders of measure, and shrunken to a microscopic level. When a CPU receives an electrical signal at a specific register, then some other register can be tripped, and then another, and so on. If those registers are made to be meaningful, then there's communication happening. Maybe a chip somewhere on the same motherboard becomes active, or an LED lights up, or a pixel on a screen changes color.
|
||||
|
||||
**[[ Related read 6 Python interpreters to try in 2022 ]][3]**
|
||||
|
||||
What comes around goes around. If you really want to detect a rodent in more places than the one spot you happen to have a mousetrap set, you could program an application to do just that. With a webcam and some rudimentary image recognition software, you could establish a baseline of what an empty kitchen looks like and then scan for changes. When a mouse enters the kitchen, there's a shift in the pixel values where there was previously no mouse. Log the data, or better yet trigger a drone that focuses in on the mouse, captures it, and moves it outside. You've built a better mousetrap through the magic of on and off signals.
|
||||
|
||||
### Compilers
|
||||
|
||||
A code compiler translates human-readable code into a machine language that speaks directly to the CPU. It's a complex process because CPUs are legitimately complex (even more complex than a mousetrap), but also because the process is more flexible than it strictly "needs" to be. Not all compilers are flexible. There are some compilers that have exactly one target, and they only accept code files in a specific layout, and so the process is relatively straight-forward.
|
||||
|
||||
Luckily, modern general-purpose compilers aren't simple. They allow you to write code in a variety of languages, and they let you link libraries in different ways, and they can target several different architectures. The [GNU C Compiler (GCC)][4] has over 50 lines of options in its `--help` output, and the LLVM `clang` compiler has over 1000 lines in its `--help` output. The GCC manual contains over 100,000 words.
|
||||
|
||||
You have lots of options when you compile code.
|
||||
|
||||
Of course, most people don't need to know all the possible options. There are sections in the GCC man page I've never read, because they're for Objective-C or Fortran or chip architectures I've never even heard of. But I value the ability to compile code for several different architectures, for 64-bit and 32-bit, and to run open source software on computers the rest of the industry has left behind.
|
||||
|
||||
### The compilation lifecycle
|
||||
|
||||
Just as importantly, there's real power to understanding the different stages of compiling code. Here's the lifecycle of a simple C program:
|
||||
|
||||
1. C source with macros (.c) is preprocessed with `cpp` to render an `.i` file.
|
||||
2. C source code with expanded macros (.i) is translated with `gcc` to render an `.s` file.
|
||||
3. A text file in Assembly language (.s) is `as`sembled with as into an `.o` file.
|
||||
4. Binary object code with instructions for the CPU, and with offsets not tied to memory areas relative to other object files and libraries (*.o) is linked with `ld` to produce an executable.
|
||||
5. The final binary file either has all required objects within it, or it's set to load linked dynamic libraries (*.so files).
|
||||
|
||||
And here's a simple demonstration you can try (with some adjustment for library paths):
|
||||
|
||||
```
|
||||
$ cat << EOF >> hello.c
|
||||
#include
|
||||
int main(void)
|
||||
{ printf("hello world\n");
|
||||
return 0; }
|
||||
EOF
|
||||
$ cpp hello.c > hello.i
|
||||
$ gcc -S hello.i
|
||||
$ as -o hello.o hello.s
|
||||
$ ld -static -o hello \
|
||||
-L/usr/lib64/gcc/x86_64-slackware-linux/5.5.0/ \
|
||||
/usr/lib64/crt1.o /usr/lib64/crti.o hello.o \
|
||||
/usr/lib64/crtn.o --start-group -lc -lgcc \
|
||||
-lgcc_eh --end-group
|
||||
$ ./hello
|
||||
hello world
|
||||
```
|
||||
|
||||
### Attainable knowledge
|
||||
|
||||
Computers have become amazingly powerful, and pleasantly user-friendly. Don't let that fool you into believing either of the two possible extremes: computers aren't as simple as mousetraps and light switches, but they also aren't beyond comprehension. You can learn about compiling code, about how to link, and compile for a different architecture. Once you know that, you can debug your code better. You can understand the code you download. You may even fix a bug or two. Or, in theory, you could build a better mousetrap. Or a CPU out of mousetraps. It's up to you.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/compiling-code
|
||||
|
||||
作者:[Alan Smithee][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/alansmithee
|
||||
[b]: https://github.com/lkxed
|
||||
[2]: https://opensource.com/article/19/5/primer-assemblers-compilers-interpreters
|
||||
[3]: https://opensource.com/article/22/9/python-interpreters-2022
|
||||
[4]: https://opensource.com/article/22/5/gnu-c-compiler
|
@ -0,0 +1,315 @@
|
||||
[#]: subject: "13 Independent Linux Distros That are Built From Scratch"
|
||||
[#]: via: "https://itsfoss.com/independent-linux-distros/"
|
||||
[#]: author: "sreenath https://itsfoss.com/author/sreenath/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
13 Independent Linux Distros That are Built From Scratch
|
||||
======
|
||||
There are hundreds of Linux distributions available.
|
||||
|
||||
But most of them fall into these three categories: Debian, Red Hat (Fedora) and Arch Linux.
|
||||
|
||||
Using a distribution based on Debian/Ubuntu, Red Hat/SUSE or Arch Linux has its advantages. They are popular and hence their package manager offers a huge range of software.
|
||||
|
||||
However, some users prefer to use Linux distributions built from scratch and be independent of DEB/RPM packaging system.
|
||||
|
||||
In this article, we will list some of the best Linux distributions developed independently.
|
||||
|
||||
**Note:** Obviously, this list excludes popular options like Debian, Ubuntu, and Fedora, which are used as bases for creating new distros. Moreover, the distributions are in no particular order of ranking.
|
||||
|
||||
### 1. NixOS
|
||||
|
||||
![Image Credits: Distrowatch][1]
|
||||
|
||||
Initially released in 2003, Nix OS is built on top of the Nix Package Manager. It provides two releases every year, usually scheduled in May and November.
|
||||
|
||||
NixOS may not be a distribution directly geared to new and average users. However, its unique approach to [package management][2] attracts various kinds of users.
|
||||
|
||||
Additionally, 32-bit support systems are also supported.
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Builds packages isolated
|
||||
* Reliable upgrade with rollback feature
|
||||
* Reproducible system configuration
|
||||
|
||||
[NixOS][3]
|
||||
|
||||
**Related**: [Advanced Linux Distributions for Expert Linux Users][4]
|
||||
|
||||
### 2. Gentoo Linux
|
||||
|
||||
![Image Credits: Distrowatch][5]
|
||||
|
||||
Gentoo Linux is an independently developed distribution aimed mainly at system experts. It is built for users who want the freedom to customize, fine-tune and optimize the operating system to suit their requirements.
|
||||
|
||||
Gentoo uses [Portage package management][6] that lets you create and install packages, often allowing you to optimize them for your hardware. **Chromium OS**, the open-source version of Chrome OS, uses Gentoo at its core.
|
||||
|
||||
Not to forget, Gentoo is one of those [distributions that still support 32-bit architectures][7].
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Incremental Updates
|
||||
* Source-based approach to software management
|
||||
* Concept of overlay repositories like GURU (Gentoo’s user repository), where users can add packages not yet provided by Gentoo
|
||||
|
||||
[Gentoo Linux][8]
|
||||
|
||||
### 3. Void Linux
|
||||
|
||||
![Image Credits: Distrowatch][9]
|
||||
|
||||
Void Linux is a [rolling release distribution][10] with its own X Binary Package System (XBPS) for installing and removing software. It was created by **Juan Romero Pardines**, a former NetBSD developer.
|
||||
|
||||
It avoids systemd and instead uses runit as its init system. Furthermore, it gives you the option to use several [desktop environments][11].
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Minimal system requirements
|
||||
* Offers an official repository for non-free packages
|
||||
* Support for Raspberry Pi
|
||||
* Integration of OpenBSD’s LibreSSL software
|
||||
* Support for musl C library
|
||||
* 32-bit support
|
||||
|
||||
[Void Linux][12]
|
||||
|
||||
**Related:** [Not a Systemd Fan? Here are 13+ Systemd-Free Linux Distributions][13]
|
||||
|
||||
### 4. Solus Linux
|
||||
|
||||
![solus budgie 2022][14]
|
||||
|
||||
Formerly EvolveOS, Solus Linux offers some exciting features while built from scratch. Solus features its own homegrown budgie desktop environment as its flagship version.
|
||||
|
||||
Compared to other options, Solus Linux is one of the few independent distributions that new Linux users can use. It manages to be one of the [best Linux distributions][15] available.
|
||||
|
||||
It uses eopkg package management with a semi-rolling release model. As per the developers, Solus is exclusively developed for personal computing purposes.
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Available in Budgie, Gnome, MATE, and KDE Plasma editions
|
||||
* Variety of software out of the box, which reduces setup efforts
|
||||
|
||||
[Solus Linux][16]
|
||||
|
||||
### 5. Mageia
|
||||
|
||||
![Image Credits: Distrowatch][17]
|
||||
|
||||
Mageia started as a fork of Mandriva Linux back in 2010. It aims to be a stable and secure operating system for desktop and server usage.
|
||||
|
||||
Mageia is a community-driven project supported by a non-profit organization and elected contributors. You will notice a major release every year.
|
||||
|
||||
##### Other Features
|
||||
|
||||
* Supports 32-bit system
|
||||
* KDE Plasma, Gnome, and XFCE editions are available from the website
|
||||
* Minimal system requirements
|
||||
|
||||
[Mageia][18]
|
||||
|
||||
**Related:** **[Linux Distros That Still Support 32-Bit Systems][19]**
|
||||
|
||||
### 6. Clear Linux
|
||||
|
||||
![Image Credits: Distrowatch][20]
|
||||
|
||||
Clear Linux is a distribution by Intel, primarily designed with performance and cloud use cases in mind.
|
||||
|
||||
One interesting thing about Clear Linux is the operating system upgrades as a whole rather than individual packages. So, even if you mess up with the system accidentally, it should boot correctly, performing a factory reset to let you set it up again.
|
||||
|
||||
It is not geared toward personal use. But it can be a unique choice to try.
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Highly tuned for Intel platforms
|
||||
* A strict separation between User and System files
|
||||
* Constant vulnerability scanning
|
||||
|
||||
[Clear Linux OS][21]
|
||||
|
||||
### 7. PCLinuxOS
|
||||
|
||||
![Image Credits: Distrowatch][22]
|
||||
|
||||
PCLinuxOS is an x86_64 Linux distribution that uses APT-RPM packages. You can get KDE Plasma, Mate, and XFCE desktops, while it also offers several community editions featuring more desktops.
|
||||
|
||||
Locally installed versions of PCLinuxOS utilize the APT package management system thanks to [Synaptic package manager][23]. You can also find rpm packages from its repositories.
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* mylivecd script allows the user to take a ‘snapshot’ of their current hard drive installation (all settings, applications, documents, etc.) and compress it into an ISO CD/DVD/USB image.
|
||||
* Additional support for over 85 languages.
|
||||
|
||||
[PCLinuxOS][24]
|
||||
|
||||
### 8. 4MLinux
|
||||
|
||||
![4m linux 2022][25]
|
||||
|
||||
[4MLinux][26] is a general-purpose Linux distribution with a strong focus on the following four **“M”** of computing:
|
||||
|
||||
* Maintenance (system rescue Live CD)
|
||||
* Multimedia (full support for a huge number of image, audio and video formats)
|
||||
* Miniserver (DNS, FTP, HTTP, MySQL, NFS, Proxy, SMTP, SSH, and Telnet)
|
||||
* Mystery (meaning a collection of classic Linux games)
|
||||
|
||||
It has a minimal system requirement and is available as a desktop and server version.
|
||||
|
||||
##### Other Features
|
||||
|
||||
* Support for large number of image, audio/video formats
|
||||
* Small and general-purpose Linux distribution
|
||||
|
||||
[4MLinux][27]
|
||||
|
||||
### 9. Tiny Core Linux
|
||||
|
||||
![Image Credits: Distrowatch][28]
|
||||
|
||||
Tiny Core Linux focuses on providing a base system using BusyBox and FLTK. It is not a complete desktop. So, you do not expect it to run on every system.
|
||||
|
||||
It represents only the core needed to boot into a very minimal X desktop, typically with wired internet access.
|
||||
|
||||
The user gets great control over everything, but it may not be an easy out-of-the-box experience for new Linux users.
|
||||
|
||||
##### Other Features
|
||||
|
||||
* Designed to run from a RAM copy created at boot time
|
||||
* By default, operates like a cloud/internet client
|
||||
* Users can run appbrowser to browse repositories and download applications
|
||||
|
||||
[Tiny Core Linux][29]
|
||||
|
||||
### 10. Linux From Scratch
|
||||
|
||||
![Image Credit: Reddit][30]
|
||||
|
||||
[Reddit][31]
|
||||
|
||||
Linux From Scratch is a way to install a working Linux system by building all its components manually. Once completed, it provides a compact, flexible and secure system and a greater understanding of the internal workings of the Linux-based operating systems.
|
||||
|
||||
If you need to dive deep into how a Linux system works and explore its nuts and bolts, Linux From Scratch is the project you need to try.
|
||||
|
||||
##### Other Features
|
||||
|
||||
* Customised Linux system, entirely from scratch
|
||||
* Extremely flexible
|
||||
* Offers added security because of self compile from source
|
||||
|
||||
[Linux From Scratch][32]
|
||||
|
||||
### 11. Slackware
|
||||
|
||||
![Image Credits: Distrowatch][33]
|
||||
|
||||
Slackware is the oldest distribution that is still being maintained. Originally created in 1993, with Softlanding Linux System as base, Slackware later became the base for many Linux distributions.
|
||||
|
||||
Slackware aims at producing the most UNIX-like Linux distribution while keeping simplicity and stability.
|
||||
|
||||
##### Other Features
|
||||
|
||||
* Available for 32-bit and 64-bit systems
|
||||
* Extensive online documentation
|
||||
* Can run on Pentium system to latest machines
|
||||
|
||||
[Slackware][34]
|
||||
|
||||
### 12. Alpine Linux
|
||||
|
||||
![alpine linux xfce 2022][35]
|
||||
|
||||
Alpine Linux is a community-developed operating system designed for routers, firewalls, VPNs, VoIP boxes, and servers. It began as a fork of the LEAF Project.
|
||||
|
||||
Alpine Linux uses apk-tools package management, initially written as a shell script and later written in C programming language. This is a minimal Linux distribution, which still supports 32-bit systems and can be installed as a run-from-RAM operating system.
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Provides a minimal container image of just 5 MB in size
|
||||
* 2-year support for the main repository and support until the next stable release for the community repository
|
||||
* Made around musl libc and Busybox with resource-efficient containers
|
||||
|
||||
[Alpine Linux][36]
|
||||
|
||||
### 13. KaOS
|
||||
|
||||
![Image Credits: Distrowatch][37]
|
||||
|
||||
KaOS is a Linux distribution built from scratch and inspired by Arch Linux. It uses [pacman for package management][38]. It is built with the philosophy “*One Desktop Environment (KDE Plasma), One Toolkit (Qt), One Architecture (x86_64)*“.
|
||||
|
||||
It has limited repositories, but still, it offers plenty of tools for a regular user.
|
||||
|
||||
##### Other Features:
|
||||
|
||||
* Most up-to-date Plasma desktop
|
||||
* Tightly integrated rolling and transparent distribution for the modern desktop
|
||||
|
||||
[KaOS][39]
|
||||
|
||||
#### Wrapping Up
|
||||
|
||||
If you need a unique experience, these independent Linux distributions should serve the purpose.
|
||||
|
||||
However, if you want to replace it with a mainstream distribution like Ubuntu for your desktop…You might want to think twice, considering most of the options (if not all) above are not ideal options for day-to-day desktop usage.
|
||||
|
||||
But then again, if you have a fair share of experience with Linux distributions, you can undoubtedly take up the task for an adventure!
|
||||
|
||||
*If you were to try one of these indie distros, which one would it be? Share with us in the comments.*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/independent-linux-distros/
|
||||
|
||||
作者:[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/wp-content/uploads/2022/10/nixos-2022.png
|
||||
[2]: https://itsfoss.com/package-manager/
|
||||
[3]: https://nixos.org/
|
||||
[4]: https://itsfoss.com/advanced-linux-distros/
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/08/gentoo-linux-plasma.jpg
|
||||
[6]: https://wiki.gentoo.org/wiki/Portage
|
||||
[7]: https://itsfoss.com/32-bit-linux-distributions/
|
||||
[8]: https://www.gentoo.org/
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/08/void-linux.jpg
|
||||
[10]: https://itsfoss.com/rolling-release/
|
||||
[11]: https://itsfoss.com/best-linux-desktop-environments/
|
||||
[12]: https://voidlinux.org/
|
||||
[13]: https://itsfoss.com/systemd-free-distros/
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/10/solus-budgie-2022.jpg
|
||||
[15]: https://itsfoss.com/best-linux-distributions/
|
||||
[16]: https://getsol.us/home/
|
||||
[17]: https://itsfoss.com/wp-content/uploads/2022/08/mageia-1.jpg
|
||||
[18]: https://www.mageia.org/en/
|
||||
[19]: https://itsfoss.com/32-bit-linux-distributions/
|
||||
[20]: https://itsfoss.com/wp-content/uploads/2022/08/clear-linux-desktop.png
|
||||
[21]: https://clearlinux.org/
|
||||
[22]: https://itsfoss.com/wp-content/uploads/2022/08/pclinuxos.png
|
||||
[23]: https://itsfoss.com/synaptic-package-manager/
|
||||
[24]: https://www.pclinuxos.com/
|
||||
[25]: https://itsfoss.com/wp-content/uploads/2022/10/4m-linux-2022.jpg
|
||||
[26]: https://itsfoss.com/4mlinux-review/
|
||||
[27]: http://4mlinux.com/
|
||||
[28]: https://itsfoss.com/wp-content/uploads/2022/03/tinycore.jpg
|
||||
[29]: http://www.tinycorelinux.net/
|
||||
[30]: https://itsfoss.com/wp-content/uploads/2022/08/enable-aur-e1659974408774.png
|
||||
[31]: https://www.reddit.com/r/linuxmasterrace/comments/udi7ts/decided_to_try_lfs_in_a_vm_started_about_a_week/
|
||||
[32]: https://www.linuxfromscratch.org/
|
||||
[33]: https://itsfoss.com/wp-content/uploads/2022/10/slackware-scaled.jpg
|
||||
[34]: http://www.slackware.com/
|
||||
[35]: https://itsfoss.com/wp-content/uploads/2022/10/alpine-linux-xfce-2022.png
|
||||
[36]: https://www.alpinelinux.org/
|
||||
[37]: https://itsfoss.com/wp-content/uploads/2022/08/kaos-desktop.png
|
||||
[38]: https://itsfoss.com/pacman-command/
|
||||
[39]: https://kaosx.us/
|
@ -0,0 +1,69 @@
|
||||
[#]: subject: "Can Kubernetes help solve automation challenges?"
|
||||
[#]: via: "https://opensource.com/article/22/10/kubernetes-solve-automation-challenges"
|
||||
[#]: author: "Rom Adams https://opensource.com/users/romdalf"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Can Kubernetes help solve automation challenges?
|
||||
======
|
||||
Automation at the organization level has been an elusive goal, but Kubernetes might be able to change all that.
|
||||
|
||||
I started my automation journey when I adopted Gentoo Linux as my primary operating system in 2002. Twenty years later, automation is not yet a done deal. When I meet with customers and partners, they share automation wins within teams, but they also describe the challenges to achieving similar success at an organizational level.
|
||||
|
||||
Most IT organizations have the ability to provision a virtual machine end to end, reducing what used to be a four-week lead time to just five minutes. That level of automation is itself a complex workflow, requiring networking (IP address management, DNS, proxy, networking zones, and so on), identity access management, [hypervisor][2], storage, backup, updating the operating system, applying the latest configuration files, monitoring, security and hardening, and compliance benchmarking. Wow!
|
||||
|
||||
It's not easy to address the business need for high velocity, scaling, and on-demand automation. For instance, consider the classic webshop or an online government service to file tax returns. The workload has well-defined peaks that need to be absorbed.
|
||||
|
||||
A common approach for handling such a load is having an oversized server farm, ready to be used by a specialized team of IT professionals, monitoring the seasonal influx of customers or citizens. Everybody wants a just-in-time deployment of an entire stack. They want infrastructure running workloads within the context of a hybrid cloud scenario, using the model of "build-consume-trash" to optimize costs while benefiting from infinite elasticity.
|
||||
|
||||
In other words, everybody wants the utopian "cloud experience."
|
||||
|
||||
### Can the cloud really deliver?
|
||||
|
||||
All is not lost, thanks mainly to the way [Kubernetes][3] has been designed. The exponential adoption of Kubernetes fuels innovation, displacing standard legacy practices for managing platforms and applications. Kubernetes requires the use of Everything-as-Code (EaC) to define the desired state of all resources, from simple compute nodes to TLS certificates. Kubernetes compels the use of three major design constructs:
|
||||
|
||||
* A standard interface to reduce integration friction between internal and external components
|
||||
* An API-first and API-only approach to standardize the CRUD (Create, Read, Update, Delete) operations of all its components
|
||||
* Use of [YAML][4] as a common language to define all desired states of these components in a simple and readable way
|
||||
|
||||
These three key components are essentially the same requirements for choosing an automation platform, at least if you want to ease adoption by cross-functional teams. This also blurs the separation of duties between teams, helping to improve collaboration across silos, which is a good thing!
|
||||
|
||||
As a matter of fact, customers and partners adopting Kubernetes are ramping up to a state of hyper-automation. Kubernetes organically drives teams to adopt multiple [DevOps foundations and practices][5]—like EaC, [version control with Git][6], peer reviews, [documentation as code][7]—and encourages cross-functional collaboration. These practices help mature a team's automation skills, and they help a team get a good start in GitOps and CI/CD pipelines dealing with both application lifecycle and infrastructure.
|
||||
|
||||
### Making automation a reality
|
||||
|
||||
You read that right! The entire stack for complex systems like a webshop or government reporting can be defined in clear, understandable, universal terms that can be executed on any on-prem or cloud provider. An autoscaler with custom metrics can be defined to trigger a just-in-time deployment of your desired stack to address the influx of customers or citizens during seasonal peaks. When metrics are back to normal, and cloud compute resources don't have a reason to exist anymore, you trash them and return to regular operations, with a set of core assets on-prem taking over the business until the next surge.
|
||||
|
||||
### The chicken and the egg paradox
|
||||
|
||||
Considering Kubernetes and cloud-native patterns, automation is a must. But it raises an important question: Can an organization adopt Kubernetes before addressing the automation strategy?
|
||||
|
||||
It might seem that starting with Kubernetes could inspire better automation, but that's not a foregone conclusion. A tool is not an answer to the problem of skills, practices, and culture. However, a well-designed platform can be a catalyst for learning, change, and cross-functional collaboration within an IT organization.
|
||||
|
||||
### Get started with Kubernetes
|
||||
|
||||
Even if you feel you missed the automation train, don't be afraid to start with Kubernetes on an easy, uncomplicated stack. Embrace the simplicity of this fantastic orchestrator and iterate with more complex needs once you've [mastered the initial steps][8].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/kubernetes-solve-automation-challenges
|
||||
|
||||
作者:[Rom Adams][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/romdalf
|
||||
[b]: https://github.com/lkxed
|
||||
[2]: https://www.redhat.com/en/topics/virtualization/what-is-a-hypervisor?intcmp=7013a000002qLH8AAM
|
||||
[3]: https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=7013a000002qLH8AAM
|
||||
[4]: https://opensource.com/article/21/9/yaml-cheat-sheet
|
||||
[5]: https://opensource.com/resources/devops
|
||||
[6]: https://opensource.com/life/16/7/stumbling-git
|
||||
[7]: https://opensource.com/article/21/3/devops-documentation
|
||||
[8]: https://opensource.com/article/17/11/getting-started-kubernetes
|
@ -0,0 +1,193 @@
|
||||
[#]: subject: "Celebrating KDE’s 26th Birthday With Some Inspiring Facts From Its Glorious Past!"
|
||||
[#]: via: "https://itsfoss.com/kde-facts-trivia/"
|
||||
[#]: author: "Avimanyu Bandyopadhyay https://www.gizmoquest.com"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Celebrating KDE’s 26th Birthday With Some Inspiring Facts From Its Glorious Past!
|
||||
======
|
||||
|
||||
Wishing a Very Happy Birthday to **KDE**!
|
||||
|
||||
Let us celebrate this moment by looking back on its glorious history with some inspiring facts on this legendary and much-loved Desktop Environment!
|
||||
|
||||
![kde birthday][1]
|
||||
|
||||
### KDE’s Origin
|
||||
|
||||
**26 years ago**, [Matthias Ettrich][2] (a German Computer Scientist currently working at [HERE][3]) founded KDE.
|
||||
|
||||
![matthias 2950607241][4]
|
||||
|
||||
When Matthias was a student at the [Eberhard Karls University of Tübingen][5], he was not satisfied as a [Common Desktop Environment (CDE)][6] user.
|
||||
|
||||
CDE is a desktop environment for Unix.
|
||||
|
||||
However, he wanted an interface that was more comfortable, simpler, and easy to use, with a better look and feel.
|
||||
|
||||
So, in 1996, Matthias Ettrich announced the **Kool Desktop Environment (KDE)**, a GUI (graphical user interface) for Unix systems, built with Qt and C ++.
|
||||
|
||||
Note that the full form of KDE was an innocent pun intended to CDE at the time. You do not usually say it as “Kool Desktop Environment”, just KDE as of now. You can read the [original announcement post][7] to get a dose of nostalgia.
|
||||
|
||||
**Trivia**: The official mascot of KDE is Konqi who has a girlfriend named Katie. Previously there used to be a wizard named [Kandalf][8] but was later replaced by Konqi because many people loved and preferred the mascot to be this charming and friendly dragon!
|
||||
|
||||
![Konqi is KDE's mascot. Katie is his girlfriend and mascot of KDE women's project.][9]
|
||||
|
||||
[Konqi][10]
|
||||
|
||||
[Katie][11]
|
||||
|
||||
And, here’s how it looked like with KDE mascot:
|
||||
|
||||
![Screenshot of earlier version of KDE desktop][12]
|
||||
|
||||
### 13 Interesting and Inspiring Facts on KDE
|
||||
|
||||
We’ve looked back into some interesting yet inspiring events that took place over the last 26 years of the KDE project:
|
||||
|
||||
#### 1. Early Development Events
|
||||
|
||||
15 developers met in Arnsberg, Germany, in 1997, to work on the KDE project and discuss its future. This event came to be known as [KDE One][13] followed by [KDE Two][14] and [KDE Three][15] and so on in the later years. They even had [one][16] for a beta version.
|
||||
|
||||
#### 2. The KDE Free Qt Foundation Agreement
|
||||
|
||||
The foundation agreement for the [KDE Free Qt Foundation][17] was signed by [KDE e.V.][18] and [Trolltech][19], then owner of the Qt Foundation who [ensured the permanent availability][20] of Qt as free software.
|
||||
|
||||
#### 3. First Stable Version
|
||||
|
||||
![kde 1][21]
|
||||
|
||||
The [first stable version][22] of KDE was released in **1998**, in addition to highlighting an application development framework, the [KOM/OpenParts][23], and an office suite preview. You can check out the [KDE 1.x Screenshots][24].
|
||||
|
||||
#### 4. The KDE Women Initiative
|
||||
|
||||
The community women’s group, [KDE Women][25], was created and announced in March 2001 with the primary goal to increase the number of women in free software communities, particularly in KDE.
|
||||
|
||||
#### 5. 1 Million Commits
|
||||
|
||||
The community [reached 1 million commits][26] within a span of only 19 months, from 500,000 in January 2006 and 750,000 in December 2007, with the launch of KDE 4 at the same time.
|
||||
|
||||
#### 6. Release Candidate of Development Platform Announced
|
||||
|
||||
A [release candidate][27] of KDE’s development platform consisting of basic libraries and tools to develop KDE applications was announced on October 2007.
|
||||
|
||||
#### 7. First KDE & Qt event in India
|
||||
|
||||
The [first conference][28] of the KDE and Qt community in India happened in Bengaluru in March 2011 that became an annual event henceforth.
|
||||
|
||||
#### 8. GCompris and KDE
|
||||
|
||||
In **December 2014**, the educational software suite [GCompris joined][29] the [project incubator of KDE community][30] (We have [previously][31] discussed GCompris, which is bundled with Escuelas Linux, a comprehensive educational distro for teachers and students).
|
||||
|
||||
#### 9. KDE Slimbooks
|
||||
|
||||
In **2016**, the KDE community partnered with a Spanish laptop retailer and [announced the launch of the KDE Slimbook][32], an ultrabook with KDE Plasma and KDE Applications pre-installed. Slimbook offers a pre-installed version of [KDE Neon][33] and [can be purchased from their website][34].
|
||||
|
||||
#### 10. Transition to GitLab
|
||||
|
||||
In **2019**, KDE [migrated][35] from Phabricator to GitLab to enhance the development process and let new contributors easy access to the workflow. However, KDE still uses bugzilla for tracking bugs.
|
||||
|
||||
#### 11. Adopts Decentralized Matrix Protocol
|
||||
|
||||
KDE added Matrix bridge to the IRC channels and powered up its native chat clients using the open-source decentralized Matrix protocol in **2019**.
|
||||
|
||||
#### 12. KDE PinePhone
|
||||
|
||||
KDE developers teamed up with [PINE64][36] in **2020** to introduce a community edition PinePhone powered by KDE.
|
||||
|
||||
#### 13. Valve Picks KDE for Steam Deck
|
||||
|
||||
Steam Deck is undoubtedly a super trending Linux gaming console right now. And, Valve chose KDE as its desktop environment to make it work in **2021**.
|
||||
|
||||
### Today, KDE is Powered by Three Great Projects
|
||||
|
||||
#### KDE Plasma
|
||||
|
||||
Previously called Plasma Workspaces, KDE Plasma facilitates a unified workspace environment for running and managing applications on various devices like desktops, netbooks, tablets or even [smartphones][37].
|
||||
|
||||
Currently, [KDE Plasma 5.26][38] is the most recent version and was released some days ago. The KDE Plasma 5 project is the fifth generation of the desktop environment and is the successor to KDE Plasma 4.
|
||||
|
||||
#### KDE Applications
|
||||
|
||||
KDE Applications are a bundled set of applications and libraries designed by the KDE community. Most of these applications are cross-platform, though primarily made for Linux.
|
||||
|
||||
A very [nice][39] project in this category is a music player called Elisa focused on an optimised integration with Plasma.
|
||||
|
||||
#### KDE Development Platform
|
||||
|
||||
The KDE Development Platform is what significantly empowers the above two initiatives, and is a collection of libraries and software frameworks released by KDE to promote better collaboration among the community to develop KDE software.
|
||||
|
||||
**Personal Note**: It was an honour covering this article on KDE’s Birthday and I would like to take this opportunity to brief some of my personal favourite KDE based apps and distros that I have extensively used in the past and continue to.
|
||||
|
||||
Check out the entire [timeline][40] in detail here for a more comprehensive outline or you can take a look at this 19-year visual changes in this interesting video:
|
||||
|
||||
![A Video from YouTube][41]
|
||||
|
||||
### Best KDE-Based Distributions
|
||||
|
||||
If you have heard all the good things about KDE, you should try out the distributions powered by KDE.
|
||||
|
||||
We have a [list of Linux distributions based on KDE][42], if you are curious.
|
||||
|
||||
*Hope you liked our favourite moments in KDE history on their 26th Anniversary! Please do write about any thoughts you might have about any of your memorable experiences with KDE in the comments below.*
|
||||
|
||||
This article was originally published in 2018, and has been edited to reflect latest information.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/kde-facts-trivia/
|
||||
|
||||
作者:[Avimanyu Bandyopadhyay][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.gizmoquest.com
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2022/10/kde-birthday.png
|
||||
[2]: https://en.wikipedia.org/wiki/Matthias_Ettrich
|
||||
[3]: https://here.com/
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/10/matthias-2950607241.jpg
|
||||
[5]: https://www.uni-tuebingen.de/en
|
||||
[6]: https://en.wikipedia.org/wiki/Common_Desktop_Environment
|
||||
[7]: https://kde.org/announcements/announcement/
|
||||
[8]: https://en.wikipedia.org/wiki/Konqi#Kandalf
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2018/10/Konqi-and-Katie.jpg
|
||||
[10]: https://en.wikipedia.org/wiki/Konqi
|
||||
[11]: https://community.kde.org/Katie
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2018/10/Konqi-from-the-early-days-who-replaced-Kandalf-right.jpg
|
||||
[13]: https://community.kde.org/KDE_Project_History/KDE_One_(Developer_Meeting)
|
||||
[14]: https://community.kde.org/KDE_Project_History/KDE_Two_(Developer_Meeting)
|
||||
[15]: https://community.kde.org/KDE_Project_History/KDE_Three_(Developer_Meeting)
|
||||
[16]: https://community.kde.org/KDE_Project_History/KDE_Three_Beta_(Developer_Meeting)
|
||||
[17]: https://www.kde.org/community/whatiskde/kdefreeqtfoundation.php
|
||||
[18]: https://www.kde.org/announcements/fsfe-associate-member.php
|
||||
[19]: https://dot.kde.org/2007/02/28/trolltech-becomes-first-corporate-patron-kde
|
||||
[20]: https://dot.kde.org/2016/01/13/qt-guaranteed-stay-free-and-open-%E2%80%93-legal-update
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/10/kde-1.jpg
|
||||
[22]: https://www.kde.org/announcements/announce-1.0.php
|
||||
[23]: https://www.kde.org/kdeslides/Usenix1998/sld016.htm
|
||||
[24]: https://czechia.kde.org/screenshots/kde1shots.php
|
||||
[25]: https://community.kde.org/KDE_Women
|
||||
[26]: https://dot.kde.org/2009/07/20/kde-reaches-1000000-commits-its-subversion-repository
|
||||
[27]: https://www.kde.org/announcements/announce-4.0-platform-rc1.php
|
||||
[28]: https://dot.kde.org/2010/12/28/confkdein-first-kde-conference-india
|
||||
[29]: https://dot.kde.org/2014/12/11/gcompris-joins-kde-incubator-and-launches-fundraiser
|
||||
[30]: https://community.kde.org/Incubator
|
||||
[31]: https://itsfoss.com/escuelas-linux/
|
||||
[32]: https://dot.kde.org/2017/01/26/kde-and-slimbook-release-laptop-kde-fans
|
||||
[33]: https://en.wikipedia.org/wiki/KDE_neon
|
||||
[34]: https://slimbook.es/en/store/slimbook-kde
|
||||
[35]: https://pointieststick.com/2020/05/23/this-week-in-kde-we-have-migrated-to-gitlab/
|
||||
[36]: https://www.pine64.org
|
||||
[37]: https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp
|
||||
[38]: https://news.itsfoss.com/kde-plasma-5-26-release/
|
||||
[39]: https://mgallienkde.wordpress.com/2018/10/09/0-3-release-of-elisa-music-player/
|
||||
[40]: https://timeline.kde.org/
|
||||
[41]: https://youtu.be/1UG4lQOMBC4
|
||||
[42]: https://itsfoss.com/best-kde-distributions/
|
@ -0,0 +1,230 @@
|
||||
[#]: subject: "How To Restrict Access To Linux Servers Using TCP Wrappers"
|
||||
[#]: via: "https://ostechnix.com/restrict-access-linux-servers-using-tcp-wrappers/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How To Restrict Access To Linux Servers Using TCP Wrappers
|
||||
======
|
||||
In this guide, we are going to learn **what is TCP Wrappers**, what is it used for, how to **install TCP Wrappers in Linux**, and how to **restrict access to Linux servers using TCP Wrappers**.
|
||||
|
||||
### What is TCP Wrappers?
|
||||
|
||||
**TCP Wrappers** (also known as **tcp_wrapper**) is an open source host-based ACL (Access Control List) system, which is used to restrict the TCP network services based on the hostname, IP address, network address, and so on. It decides which host should be allowed to access a specific network service.
|
||||
|
||||
TCP Wrapper was developed by a Dutch programmer and physicist **Wietse Zweitze Venema** in 1990 at the Eindhoven University of Technology. He maintained it until 1995, and then released it under BSD License in 2001.
|
||||
|
||||
### Is TCP Wrappers a replacement for Firewalls?
|
||||
|
||||
**No.** Please be aware that **TCP Wrapper is not a complete replacement for properly configured firewall**. It is just a **valuable addition to** **enhance your Linux server's security**.
|
||||
|
||||
Some Linux distributions such as Debian, Ubuntu have dropped the TCP Wrappers from the official repositories. Because, the last version of tcp_wrappers was released 20 years ago. At that time it was very powerful tool to "block all traffic".
|
||||
|
||||
However, these days we can do the same thing using firewalls/iptables/nftables for all traffic on **network level** or use similar filtering at the application level. But TCP Wrappers blocks incoming connection on application level only.
|
||||
|
||||
If you still prefer to use TCP Wrappers for any reason, it is always recommended to use TCP Wrappers in conjunction with a properly configured firewall and other security mechanisms and tools to harden your Linux server's security.
|
||||
|
||||
### Install TCP Wrappers in Linux
|
||||
|
||||
TCP Wrappers is available in the official repositories of most Linux operating systems.
|
||||
|
||||
Depending upon the Linux distribution you use, TCP Wrappers can be installed as shown below.
|
||||
|
||||
**On Arch-based systems**, make sure the [Community] repository is enabled and run the following command to TCP Wrappers in Arch Linux and its variants such as EndeavourOS and Manjaro Linux:
|
||||
|
||||
```
|
||||
$ sudo pacman -S tcp-wrappers
|
||||
```
|
||||
|
||||
**On Fedora , RHEL, CentOS, AlmaLinux and Rocky Linux:**
|
||||
|
||||
Make sure you've enabled the **[EPEL]** repository:
|
||||
|
||||
```
|
||||
$ sudo dnf install epel-release
|
||||
```
|
||||
|
||||
And then install TCP wrappers using command:
|
||||
|
||||
```
|
||||
$ sudo dnf install tcp_wrappers
|
||||
```
|
||||
|
||||
On RHEL 6 systems, you need to use yum instead of dnf to install TCP wrappers.
|
||||
|
||||
```
|
||||
$ sudo yum install tcp_wrappers
|
||||
```
|
||||
|
||||
### Configure TCP Wrappers
|
||||
|
||||
TCP Wrappers implements the access control with the help of two configuration files:
|
||||
|
||||
* /etc/hosts.allow,
|
||||
* /etc/hosts.deny.
|
||||
|
||||
These two access control list files decides whether or not the specific clients are allowed to access your Linux server.
|
||||
|
||||
#### The /etc/hosts.allow file
|
||||
|
||||
The `/etc/hosts.allow` file contains the list of allowed or non-allowed hosts or networks. It means that we can both allow or deny connections to network services by defining access rules in this file.
|
||||
|
||||
#### The /etc/hosts.deny file
|
||||
|
||||
The `/etc/hosts.deny` file contains the list of hosts or networks that are not allowed to access your Linux server. The access rules in this file can also be set up in `/etc/hosts.allow` with a **'deny'** option.
|
||||
|
||||
The typical syntax to define an access rule is:
|
||||
|
||||
```
|
||||
daemon_list : client_list : option : option ...
|
||||
```
|
||||
|
||||
Where,
|
||||
|
||||
* daemon_list - The name of a network service such as SSH, FTP, Portmap etc.
|
||||
* clients_list - The comma separated list of valid hostnames, IP addresses or network addresses.
|
||||
* options - An optional action that specifies something to be done whenever a rule is matched.
|
||||
|
||||
The syntax is same for both files.
|
||||
|
||||
### Rules to remember
|
||||
|
||||
Before using TCP Wrappers, you need to know the following important rules. Please be mindful that the TCP Wrapper consults only these two files (hosts.allow and hosts.deny).
|
||||
|
||||
* The access rules in the `/etc/hosts.allow` file are applied first. They takes precedence over rules in `/etc/hosts.deny` file. Therefore, if access to a service is allowed in `/etc/hosts.allow` file, and a rule denying access to that same service in `/etc/hosts.deny` is ignored.
|
||||
* Only one rule per service is allowed in both files (hosts.allow and `hosts.deny` files).
|
||||
* The order of the rules is very important. Only the first matching rule for a given service will be taken into account. The same applies for both files.
|
||||
* If there are no matching rules for a service in either files or if neither file exist, then access to the service will be granted to all remote hosts.
|
||||
* Any changes in either files will come to effect immediately without restarting the network services.
|
||||
|
||||
### Restrict Access To Linux Servers Using TCP Wrappers
|
||||
|
||||
The recommended approach to secure a Linux server is to **block all incoming connections**, and allow only a few specific hosts or networks.
|
||||
|
||||
To do so, edit **/etc/hosts.deny** file:
|
||||
|
||||
```
|
||||
$ sudo vi /etc/hosts.deny
|
||||
```
|
||||
|
||||
Add the following line. This line refuses connections to ALL services and ALL networks.
|
||||
|
||||
```
|
||||
ALL: ALL
|
||||
```
|
||||
|
||||
Then, edit **/etc/hosts.allow** file:
|
||||
|
||||
```
|
||||
$ sudo vi /etc/hosts.allow
|
||||
```
|
||||
|
||||
and allow the specific hosts or networks of your choice.
|
||||
|
||||
```
|
||||
sshd: 192.168.43.192 192.168.43.193
|
||||
```
|
||||
|
||||
You can also specify valid hostnames instead of IP address as shown below.
|
||||
|
||||
```
|
||||
sshd: server1.ostechnix.lan server2.ostechnx.lan
|
||||
```
|
||||
|
||||
Alternatively, you can do the same by defining all rules (both allow and deny) in `/etc/hosts.allow` file itself.
|
||||
|
||||
Edit **/etc/hosts.allow** file and add the following lines.
|
||||
|
||||
```
|
||||
sshd: 192.168.43.192 192.168.43.193
|
||||
sshd: ALL: DENY
|
||||
```
|
||||
|
||||
In this case, you don't need to specify any rule in `/etc/hosts.deny` file.
|
||||
|
||||
As per above rule, all incoming connections will be denied for all hosts except the two hosts 192.168.43.192, 192.168.43.193.
|
||||
|
||||
Now, try to SSH to your Linux server from any hosts except the above hosts, you will get the following error.
|
||||
|
||||
```
|
||||
ssh_exchange_identification: read: Connection reset by peer
|
||||
```
|
||||
|
||||
You can verify this from your Linux server's log files as shown below.
|
||||
|
||||
```
|
||||
$ cat /var/log/secure
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
```
|
||||
Jun 16 19:40:17 server sshd[15782]: refused connect from 192.168.43.150 (192.168.43.150)
|
||||
```
|
||||
|
||||
Similarly, you can define rules for other services, say for example vsftpd, in `/etc/hosts.allow` file as shown below.
|
||||
|
||||
```
|
||||
vsftpd: 192.168.43.192
|
||||
vsftpd: ALL: DENY
|
||||
```
|
||||
|
||||
Again, you don't need to define any rules in `/etc/hosts.deny` file. As per the above rule, a remote host with IP address 192.168.43.192 is allowed to access the Linux server via FTP. All other hosts will be denied.
|
||||
|
||||
Also, you can define the access rules in different formats in /etc/hosts.allow file as shown below.
|
||||
|
||||
```
|
||||
sshd: 192.168.43.192 #Allow a single host for SSH service
|
||||
sshd: 192.168.43.0/255.255.255.0 #Allow a /24 prefix for SSH
|
||||
vsftpd: 192.168.43.192 #Allow a single host for FTP
|
||||
vsftpd: 192.168.43.0/255.255.255.0 #Allow a /24 prefix for FTP
|
||||
vsftpd: server1.ostechnix.lan #Allow a single host for FTP
|
||||
```
|
||||
|
||||
#### Allow all hosts except a specific host
|
||||
|
||||
You can allow incoming connections from all hosts, but not from a specific host. Say for example, to allow incoming connections from all hosts in the **192.168.43** subnet, but not from the host **192.168.43.192**, add the following line in `/etc/hosts.allow` file.
|
||||
|
||||
```
|
||||
ALL: 192.168.43. EXCEPT 192.168.43.192
|
||||
```
|
||||
|
||||
In the above case, you don't need to add any rules in /etc/hosts.deny file.
|
||||
|
||||
Or you can specify the hostname instead of IP address as shown below.
|
||||
|
||||
```
|
||||
ALL: .ostechnix.lan EXCEPT badhost.ostechnix.lan
|
||||
```
|
||||
|
||||
For more details, refer the man pages.
|
||||
|
||||
```
|
||||
$ man tcpd
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
As you can see, securing network services in your Linux systems with TCP Wrappers is easy! But keep in mind that TCP Wrapper is not a replacement for a firewall. It should be used in conjunction with firewalls and other security tools.
|
||||
|
||||
**Resource:**
|
||||
|
||||
* [Wikipedia][1]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/restrict-access-linux-servers-using-tcp-wrappers/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://en.wikipedia.org/wiki/TCP_Wrapper
|
@ -0,0 +1,111 @@
|
||||
[#]: subject: "Install Gedit on Ubuntu 22.10 and Make it Default Text Editor"
|
||||
[#]: via: "https://itsfoss.com/install-gedit-ubuntu/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Install Gedit on Ubuntu 22.10 and Make it Default Text Editor
|
||||
======
|
||||
|
||||
[GNOME has a brand new text editor][1] to replace the good old Gedit editor.
|
||||
|
||||
While it was already available with GNOME 42, Ubuntu 22.04 relied on Gedit.
|
||||
|
||||
This is changing in Ubuntu 22.10. GNOME Text Editor is the default here and Gedit is not even installed.
|
||||
|
||||
![Searching for text editor only brings GNOME Text Editor][2]
|
||||
|
||||
While the new editor is good enough, not everyone would like it. This is especially if you use Gedit extensively with additional plugins.
|
||||
|
||||
If you are among those people, let me show you how to install Gedit on Ubuntu. I’ll also share how you can make it the default text editor.
|
||||
|
||||
### Install Gedit on Ubuntu
|
||||
|
||||
This is actually a no-brainer. While Gedit is not installed by default, it is still available in Ubuntu repositories.
|
||||
|
||||
So, all you have to do is to use the apt command to install it:
|
||||
|
||||
```
|
||||
sudo apt install gedit
|
||||
```
|
||||
|
||||
Gedit is also available in the software center but it is the snap package. You could install that if you want.
|
||||
|
||||
![Gedit is also available in Ubuntu’s Snap Store][3]
|
||||
|
||||
#### Install Gedit Plugins (optional)
|
||||
|
||||
By default, Gedit gives you the option to access a few plugins. You can enable or disable the plugins from the menu->preference->plugins.
|
||||
|
||||
![Accessing plugins in Gedit][4]
|
||||
|
||||
You should see the available plugins here. The installed or in-use plugins are checked.
|
||||
|
||||
![See the available and installed plugins in Gedit][5]
|
||||
|
||||
However, you can take the plugin selection to the next level by installing the gedit-plugins meta package.
|
||||
|
||||
```
|
||||
sudo apt install gedit-plugins
|
||||
```
|
||||
|
||||
This will give you access to additional plugins like bookmarks, bracket completion, Python console and more.
|
||||
|
||||
![Additional Gedit plugins][6]
|
||||
|
||||
**Tip**: If you notice that Gedit looks a bit out of place for the lack of around bottom corners, you can install a GNOME extension called [Round Bottom Corner][7]. This will force round bottom corners for all applications including Gedit.
|
||||
|
||||
### Make Gedit the default text editor
|
||||
|
||||
Alright! So you have installed Gedit but the text files still open in GNOME Text Editor with double click action. To open a file with Gedit, you need to right click and then select the ‘open with’ option.
|
||||
|
||||
If you want Gedit to open text files all the time, you can set it as default.
|
||||
|
||||
Right click on a text file and go with “open with” option. Select Gedit here and enable the “Always use for this file type” option from the bottom.
|
||||
|
||||
![Set Gedit as the default text editor][8]
|
||||
|
||||
### Remove Gedit
|
||||
|
||||
Don’t feel Gedit is up to the mark? That’s rare, but I am not judging you. To remove Gedit from Ubuntu, use the following command:
|
||||
|
||||
```
|
||||
sudo apt remove gedit
|
||||
```
|
||||
|
||||
You may also try uninstalling it from the software center.
|
||||
|
||||
### Conclusion
|
||||
|
||||
GNOME Text Editor is the next-gen, created-from-scratch editor that blends well with the new GNOME.
|
||||
|
||||
It’s good enough for simple text editing. However, Gedit has a plugin ecosystem that gives it more feature.
|
||||
|
||||
For those who use it extensively for coding and other stuff, installing Gedit is still an option in Ubuntu.
|
||||
|
||||
What about you? Will you stick with the default new text editor or would you go back to the good old Gedit?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-gedit-ubuntu/
|
||||
|
||||
作者:[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/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/gnome-text-editor/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/10/text-editor-ubuntu.png
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/10/install-gedit-from-ubuntu-software-center.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/10/access-plugins-in-gedit.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/10/plugins-in-gedit.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/10/additional-plugins-gedit.png
|
||||
[7]: https://extensions.gnome.org/extension/5237/rounded-window-corners/
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/10/set-gedit-default.png
|
@ -0,0 +1,108 @@
|
||||
[#]: subject: "How to Enable and Access USB Drive in VirtualBox"
|
||||
[#]: via: "https://www.debugpoint.com/enable-usb-virtualbox/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Enable and Access USB Drive in VirtualBox
|
||||
======
|
||||
Here’s a precise guide on how you can enable USB in Oracle VirtualBox.
|
||||
|
||||
![][1]
|
||||
|
||||
When you work in a Virtual machine environment, the USB is usually plugged into the host system. But it is a little difficult to access that USB content from the guest system.
|
||||
|
||||
In VirtualBox, you need to install some extensions and enable some settings to access USB in. Here’s how.
|
||||
|
||||
This article assumes that you have already installed VirtualBox and also installed some Linux distribution or operating system inside it.
|
||||
|
||||
If not, check out the [articles here][2].
|
||||
|
||||
### Enable USB in VirtualBox 7.0
|
||||
|
||||
#### Install VirtualBox Extension Pack
|
||||
|
||||
* Open the VirtualBox download page and download the VirtualBox Extension pack for all supported platforms using [this link][3].
|
||||
|
||||
![Download the extension pack][4]
|
||||
|
||||
* Then Click on `File > Tools > Extension Pack Manager.`
|
||||
|
||||
* Click on the `Install` button in the toolbar and select the downloaded .vbox-extpak file.
|
||||
|
||||
* Hit `Install`. Accept the terms, and give the admin password for the installation.
|
||||
|
||||
![install extension pack manager][5]
|
||||
|
||||
![install extension pack manager after accepting terms][6]
|
||||
|
||||
* After successful installation, you can see it in the installed list.
|
||||
|
||||
* Restart your host system. Restarting is mandatory.
|
||||
|
||||
#### Enable USB in the guest box
|
||||
|
||||
* Plugin the USB stick into your host system – which you want to access from the guest virtual machine.
|
||||
|
||||
* Start VirtualBox and right-click on the VM name where you want to enable USB. Select Settings.
|
||||
|
||||
![Launch settings for the virtual machine][7]
|
||||
|
||||
* On the left pane, click on USB. Then select the controller version. For example, you can select USB 3.0. Then click on the small plus icon to add a USB filter.
|
||||
|
||||
* In this list, you should see your USB stick name (which you plugged in). For this example, I can see my Transcend Jetflash drive, which I plugged in.
|
||||
|
||||
* Select it and press OK.
|
||||
|
||||
![Select the USB stick][8]
|
||||
|
||||
* Now, start your virtual machine. Open the file manager, and you should see the USB is enabled and mounted on your virtual machine.
|
||||
|
||||
* In this demonstration, you can see the Thunar file manager of my [Arch-Xfce][9] virtual machine is showing the contents of my USB stick.
|
||||
|
||||
![Enabling USB and accessing contents from VirtualBox][10]
|
||||
|
||||
### Usage notes
|
||||
|
||||
Now, here are a couple of things you should remember.
|
||||
|
||||
* When you plug in the USB in the host system, keep it mounted. But do not open or access any file before launching the virtual machine.
|
||||
|
||||
* Once you start your virtual machine, the USB will be unmounted in the host system and auto-mounted in the guest system, i.e. your virtual machine.
|
||||
|
||||
* After you finish with a USB stick, ensure to eject or unmount it inside a virtual machine. Then it will be accessible again inside your host system.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
VirtualBox is a powerful utility and provides easy-to-use features to extensively set up your Virtual Machines. The steps are straightforward, and make sure your USB stick is detected properly in the host system to work.
|
||||
|
||||
Also, remember that USB stick detection via extension pack is not related to VirtualBox guest addition. They are completely unrelated and provide separate functions.
|
||||
|
||||
Finally, let me know if this guide helps you in the comment box.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/enable-usb-virtualbox/
|
||||
|
||||
作者:[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/wp-content/uploads/2022/10/usb-vbox-1024x576.jpg
|
||||
[2]: https://www.debugpoint.com/tag/virtualbox
|
||||
[3]: https://www.virtualbox.org/wiki/Downloads
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/10/Download-the-extension-pack.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/10/install-extension-pack-manager.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/10/install-extension-pack-manager-after-accepting-terms.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/10/Launch-settings-for-the-virtual-machine.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/10/Select-the-USB-stick.jpg
|
||||
[9]: https://www.debugpoint.com/xfce-arch-linux-install-4-16/
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2022/10/Enabling-USB-and-accessing-contents-from-VirtualBox.jpg
|
@ -1,255 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (aREversez)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (The Real Novelty of the ARPANET)
|
||||
[#]: via: (https://twobithistory.org/2021/02/07/arpanet.html)
|
||||
[#]: author: (Two-Bit History https://twobithistory.org)
|
||||
|
||||
ARPANET 的真正创新之处
|
||||
======
|
||||
|
||||
如果你在搜索引擎中输入“ARPANET”,搜索相关图片,你会看到许多地图的图片,上面是上世纪六十年代末七十年代初 [美国政府创建的研究网络][1],该网络不断延伸扩展,横跨了整个美国。我猜很多人第一次了解到 ARPANET 的时候都看过这种地图。
|
||||
|
||||
可以说,这些地图很有意思,毕竟我们很难想象过去连接网络的计算机是那么少,就连如此低保真的图片都可以表示出美国全部机器的所在位置(这里的低保真指的是高射投影仪成像技术,而不是大家熟知的 lo-fi 氛围音乐)。不过,这些地图是有问题的。地图上加粗的线条连接着大陆各地,强化了人们的一种观念:ARPANET 最大的贡献就是首次将横跨美国东西两地的电脑连接了起来。
|
||||
|
||||
今天,即便是在病毒肆虐、人们困居家中的情况下,网络也能把我们联系起来,可谓是我们的生命线。所以,如果认为 ARPANET 是最早的互联网,那么在那之前世界必然相互隔绝,毕竟那时还没有今天的互联网,对吧?ARPANET 首次通过计算机将人们连接起来,一定是一件惊天动地的大事。
|
||||
|
||||
但是,这一观点却与历史事实不符,而且它也没有进一步解释 ARPANET 的重要性。
|
||||
|
||||
### 初露锋芒
|
||||
|
||||
华盛顿希尔顿酒店坐落于国家广场东北方向约 2.4 千米处的一座小山丘山顶附近。酒店左右两侧白色的现代化立面分别向外延展出半个圆形,活像一只飞鸟的双翼。1965 年,酒店竣工之后,纽约时报报道称这座建筑物就像“一只栖息在山顶巢穴上的海鸥”[1][2]。
|
||||
|
||||
不过,这家酒店最有名的特点却深藏在地下。在车道交汇处下方,有着一个巨大的蛋形活动场地,这就是人们熟知的国际宴会厅,多年来一直是华盛顿特区最大的无柱宴会厅。1967 年,大门乐队在此举办了一场音乐会。1968 年,“吉他之神”吉米·亨德里克斯也在此举办了一场音乐会。到了 1972 年,国际宴会厅隐去了以往的喧嚣,举办了首届国际计算机通信会议。在这场大会上,研究项目 ARPANET 首次公开亮相。
|
||||
|
||||
1972 年的国际计算机通信会议举办时间为 10 月 24-26 日,与会人数约八百人[2][3]。在这场大会上,计算机网络这一新兴领域的领袖人物齐聚一堂。因特网的先驱鲍勃·卡恩称,“如果有人在华盛顿希尔顿酒店上方丢了一颗炸弹,那么美国的整个网络研究领域将会毁于一旦”[3][4]。
|
||||
|
||||
当然,不是所有的与会人员都是计算机科学家。根据当时的宣传广告,这场大会将会聚焦用户,照顾到“律师、医务人员、经济学家、政府工作者、工程师以及通信员等从业人员”[4][5]。虽然大会的部分议题非常专业,比如“数据网络设计问题(一)”与“数据网络设计问题(二)”,但是正如宣传广告所承诺的,大部分会议的主要关注点还是计算机网络给经济社会带来的潜在影响。其中甚至有一场会议以惊人的先见之明探讨了如何积极利用法律制度“保护计算机数据库中的隐私权益”[5][6]。
|
||||
|
||||
展示 ARPANET 的目的在于尽可能地吸引与会者的关注。各场会议在国际宴会厅或酒店更下一层的其他地方举行,会议休息期间,与会者可以自由进入乔治敦宴会厅(在国际宴会厅走廊尽头的一个较小的宴会厅,也可以说是会议室)[6][7],那里放置着 40 台由不同制造商生产的终端,用以访问 ARPANET [7][8]。这些终端属于哑终端,也就是说,只能用来输入命令、输出结果,本身无法进行计算。事实上,因为是 1972 年,所以这些终端可能都是硬拷贝终端,即电传打字机。哑终端与一台被称为“终端接口信息处理机”(TIP)的计算机相连接,后者放置在宴会厅中间的一个高台上。TIP 是早期的一种路由器,哑终端可通过 TIP 连接到 ARPANET。有了终端和 TIP,ICCC 与会者可以尝试登录和访问组成 ARPANET 的 29 个主机站的计算机 [8][9]。
|
||||
|
||||
为了展示网络的性能,美国全国各主机站的研究员们通力合作,准备了 19 个简易的“情景”,供用户测试使用。他们还出了 [一份小册子][10],将这些情景收录其中。如果与会人员打算进入这个满是电线与哑终端的房间,就会得到这样一本小册子 [9][11]。通过这些情景,研究员不仅要证明网络这项新技术的可行性,还要证明其实用性,因为 ARPANET 那时还只是“一条没有汽车驶过的公路”。此外,来自国防部的投资者们也希望,公开展示 ARPANET 可以进一步激发人们对网络的兴趣 [10][12]。
|
||||
|
||||
因此,这些情景充分展示了在 ARPANET 网络上可以使用的软件的丰富性:有程序语言解释器,其中一个是麻省理工学院(MIT) Lisp 语言的解释器,另一个是加州大学洛杉矶分校的数值计算环境 Speakeasy 项目的解释器;还有一些游戏,包括国际象棋和 <ruby>康威生命游戏<rt>Conway's Game of Life</rt></ruby>;以及最受与会者欢迎的几个人工智能聊天程序,包括由 MIT 的计算机科学家约瑟夫·魏泽堡开发的著名聊天程序伊莉莎。
|
||||
|
||||
设置情景的研究人员小心翼翼地列出了他们想让用户在终端机上输入的每一条命令。这点很重要,因为用于连接 ARPANET 主机的命令序列可能会因为主机的不同而发生变化。比如,为了能在 MIT 人工智能实验室的 PDP-10 微型电脑上测试人工智能国际象棋程序,与会者需要按照指示输入以下命令:
|
||||
|
||||
在下方代码块中, _`[LF]`、`[SP]` 以及 `[CR]` 分别代表换行、空格以及回车键。我在每行的 `//` 符号后面都解释了当前一行命令的含义,不过当时的小册子本来是没有使用这一符号的。
|
||||
|
||||
```
|
||||
@r [LF] // 重置 TIP
|
||||
@e [SP] r [LF] // “远程回显”设置, 主机回显字符,TIP 不回显
|
||||
@L [SP] 134 [LF] // 连接 134 号主机
|
||||
:login [SP] iccXXX [CR] // 登录 MIT 人工智能实验室的系统,“XXX”代表用户名首字母缩写
|
||||
:chess [CR] // 启动国际象棋程序
|
||||
```
|
||||
|
||||
如果与会者输入了上述命令,那么他就可以体验当时最先进的国际象棋程序,其棋盘布局如下:
|
||||
|
||||
```
|
||||
BR BN BB BQ BK BB BN BR
|
||||
BP BP BP BP ** BP BP BP
|
||||
-- ** -- ** -- ** -- **
|
||||
** -- ** -- BP -- ** --
|
||||
-- ** -- ** WP ** -- **
|
||||
** -- ** -- ** -- ** --
|
||||
WP WP WP WP -- WP WP WP
|
||||
WR WN WB WQ WK WB WN WR
|
||||
```
|
||||
|
||||
与之不同的是,如果要连接加州大学洛杉矶分校的 IBM System/360 机器,运行 Speakeasy 数值计算环境,与会者需要输入以下命令:
|
||||
|
||||
```
|
||||
@r [LF] // 重置 TIP
|
||||
@t [SP] o [SP] L [LF] // “传递换行”设置
|
||||
@i [SP] L [LF] // “插入换行”设置,即回车时发送换行符。
|
||||
@L [SP] 65 [LF] // 连接 65 号主机
|
||||
tso // 连接 IBM 分时可选软件系统
|
||||
logon [SP] icX [CR] // 输入用户名,进行登录,“X”可为任意数字
|
||||
iccc [CR] // 输入密码(够安全!)
|
||||
speakez [CR] // 启动 Speakeasy
|
||||
```
|
||||
|
||||
输入上述命令后,与会者可以在终端中对矩阵进行乘法、转置以及其他运算,如下所示:
|
||||
|
||||
```
|
||||
:+! a=m*transpose(m);a [CR]
|
||||
:+! eigenvals(a) [CR]
|
||||
```
|
||||
|
||||
当时,这场演示给许多人都留下了深刻的印象,但原因并不是我们所想的那样,毕竟我们有的只是后见之明。今天的人们总是记不住,在 1972 年,即便身处两个不同的城市,远程登录使用计算机也已经不是一件新鲜事儿了。在那之前的数十年,电传打字机就已经用于与相隔很远的计算机传递信息了。在 ICCC 第一届大会之前,差不多整整五年,在西雅图的一所高中,比尔·盖茨使用电传打字机,在该市其他地方的通用电气计算机上运行了他的第一个 BASIC 程序。在当时,登录远程计算机,运行几行命令或者玩一些文字游戏,只不过是家常便饭。因此,虽说上文提到的软件的确很不错,但是即便没有 ARPANET,我刚刚介绍的两个情景勉强也是可以实现的。
|
||||
|
||||
当然,ARPANET 一定带来了新的东西。参加本次大会的律师、政治家与经济学家关注更多的可能是国际象棋游戏与聊天机器人,但是网络专家们可能对另外两个情景更感兴趣,因为它们将 ARPANET 的作用更好地展示了出来。
|
||||
|
||||
在其中一个情景下,MIT <ruby>非兼容分时系统<rt>ITS</rt></ruby> 上运行了一个名为 `NETWRK` 的程序。`NETWRK` 命令下有若干个子命令,输入这些子命令就能得到 ARPANET 各方面的运行状态。`SURVEY` 子命令可以列出 ARPANET 上面运行的主机与空闲的主机,放入一个列表中;`SUMMARY.OF.SURVEY` 子命令对 `SURVEY` 子命令的运行结果进行统计,得出每台主机的“正常运行比率”,以及每台主机响应消息的平均时间。`SUMMARY.OF.SURVEY` 子命令以表格的形式输出结果,如下所示:
|
||||
|
||||
```
|
||||
--HOST-- -#- -%-UP- -RESP-
|
||||
UCLA-NMC 001 097% 00.80
|
||||
SRI-ARC 002 068% 01.23
|
||||
UCSB-75 003 059% 00.63
|
||||
...
|
||||
```
|
||||
|
||||
可以看到,主机编号的占位不超过三个数字。其他 `NETWRK` 子命令能够查看较长时间内查询结果的概要,或者检查单个主机查询结果的日志。
|
||||
|
||||
第二个情景用到了斯坦福大学开发的一款软件——SRI-ARC 联机系统。这款软件功能齐全,非常优秀。美国发明家道格拉斯·恩格尔巴特在 <ruby>所有演示之母<rt>Mother of All Demos</rt></ruby> 上演示的正是 SRI-ARC 联机系统。这款软件可以在加州大学圣芭芭拉分校的主机上运行本质上属于文件托管的服务。使用华盛顿希尔顿酒店的终端,用户就可以将斯坦福大学主机上创建的文件复制到加州大学圣芭芭拉分校的主机上。操作也很简单,只需执行 `copy` 命令,然后回答计算机的下列问题:
|
||||
|
||||
_在下方的代码块中,`[ESC]`、`[SP]` 与 `[CR]` 分别代表退出、空格与回车键;圆括号中的文字是计算机打印出的提示信息;第三行中的退出键用于自动补全文件名。此处复制的文件是 `<system>sample.txt;1`,其中文件名末尾的数字 1 代表文件的版本号,`<system>` 表示文件路径。这种文件名是 TENEX 操作系统上面的惯用写法。_[11][13]
|
||||
|
||||
```
|
||||
@copy
|
||||
(TO/FROM UCSB) to
|
||||
(FILE) <system>sample [ESC] .TXT;1 [CR]
|
||||
(CREATE/REPLACE) create
|
||||
```
|
||||
|
||||
这两个情景看起来好像和最初提及的两个情景没有太大区别,但是此二者却意义非凡。因为它们证明了,在 ARPANET 上面,不仅人们可以与计算机进行交流,计算机与计算机也可以 _相互_ 交流。保存在 MIT 的 `SURVEY` 命令的结果并非由人类定期登录并检查每台机器的运行状态收集而来,而是由一款能在网络上与其他机器进行交流的软件收集得到的。同样的道理,在斯坦福大学与加州大学圣芭芭拉分校之间传输文件的情景下,也没有人守在两所大学的终端旁边,特区的终端用户仅仅使用了一款软件,就能让其他两地的计算机连接起来。此外,这一点无关乎你使用的是宴会厅里的哪一台电脑,因为只要输入同样的命令序列,就能在任意一台电脑上浏览 MIT 的网络监视数据,或者在加州大学圣芭芭拉分校的计算机上储存文件。
|
||||
|
||||
这才是 ARPANET 的全新之处。本次国际计算机通信会议演示的不仅仅是人与远程电脑之间的交互,也不仅仅是远程输入输出的操作,更是一个软件与其他软件之间的远程通讯,这一点才是史无前例的。
|
||||
|
||||
为什么这一点才是最重要的,而不是地图上画着的那些贯穿整个美国、实际连接起来的电线呢(这些线是租赁的电话线,而且它们以前就在那了!)?要知道,早在 1966 年 ARPANET 项目启动之前,美国国防部的高级研究计划署打造了一间终端室,里面有三台终端。三台终端分别连接着位于 MIT、加州大学伯克利分校以及圣塔莫尼卡三地的计算机 [12][14]。对于高级研究计划署的工作人员来说,即便他们身处华盛顿特区,使用这三台计算机也非常方便。不过,这其中也有不便之处:工作人员必须购买和维护来自三家不同制造商的终端,牢记三种不同的登录步骤,熟悉三种不同的计算环境。虽然这三台终端机可能就放在一起,但是它们只是电线另一端主机系统的延申,而且操作也和那些计算机一样各不相同。所以说,在 ARPANET 项目诞生之前,远程连接计算机进行通讯就已经实现了,但问题是不同的计算系统阻碍了通讯朝着更加先进复杂的方向发展。
|
||||
|
||||
### 此刻,集合起来
|
||||
|
||||
因此,我想说的是,说法一(ARPANET 首次通过计算机将不同地方的人们连接了起来)与说法二(ARPANET 首次将多个计算机系统彼此连接了起来)之间有着云泥之别。听起来似乎有些吹毛求疵,咬文嚼字,但是相较于说法二,说法一忽略了一些重要的历史发展阶段。
|
||||
|
||||
首先,历史学家乔伊·利西·兰金(Joy Lisi Rankin)指出,早在 ARPANET 诞生之前,人们就已经在网络空间中进行交流了。在《美国人民的计算机历史》(_A People’s History of Computing in the United States_)一书中,兰金介绍了多个覆盖全国的数字社区,这些社区运行在早于 ARPANET 的分时网络上面。从技术层面讲,分时网络并不属于计算机网络,因为它仅仅由一台大型主机构成。这种计算机放置在地下室中,为多台哑终端提供计算,颇像一只又黑又胖的奇怪生物,触手向外伸展着,遍及整个美国。不过,在分时网络时代,被后社交媒体时代称为“网络”的大部分社会行为应有尽有。例如,Kiewit 网络是达特茅斯分时系统的延申应用,服务于美国东北部的各个大学和高中。在 Kiewit 网络上,高中生们共同维护着一个“<ruby>八卦文件<rt>gossip file</rt></ruby>”,用来记录其他学校发生的趣闻趣事,“在康涅狄格州和缅因州之间建立起了社交联系” [13][15]。同时,曼荷莲女子学院的女生通过网络与达特茅斯学院的男生进行交流,或者是安排约会,或者是与男朋友保持联系 [14][16]。这些事实都发生在上世纪六十年代。兰金认为,如果忽视了早期的分时网络,我们对美国过去 50 年数字文化发展的认识必然是贫瘠的:我们眼里可能只有所谓的“<ruby>硅谷神话<rt>Silicon Valley mythology</rt></ruby>”,认为计算机领域的所有发展都要归功于少数的几位天才,或者说互联网科技巨头的创始人。
|
||||
|
||||
回到 ARPANET,如果我们能意识到真正的困难是计算机 _系统_ 的联通,而非机器本身的连接,那么在探讨 ARPANET 的创新点时,我们就会更加倾向于第二种说法。ARPANET 是第一个包交换网络,涉及到许多重要的技术应用。但是如果仅仅因为这项优势,就说它是一项突破,我觉得这种说法本身就是错的。ARPANET 旨在促进全美计算机科学家之间的合作,目的是要弄明白不同的操作系统与不同语言编写的软件如何配合使用,而非如何在麻省和加州之间实现高效的数据传输。因此,ARPANET 不仅是第一个包交换网络,它还是一项非常成功且优秀的标准。在我看来,后者更有意思,毕竟我在博客上曾经写过许多颇有瑕疵的标准:[语义网][17]、[RSS][18] 与 [FOAF ][19]。
|
||||
|
||||
ARPANET 项目初期没有考虑到网络协议,协议的制定是后来的事情了。因此,这项工作自然落到了主要由研究生组成的组织——<ruby>国际网络工作组<rt>Network Working Group</rt></ruby> 身上。该组织的首次会议于 1968 年在加州大学圣芭芭拉分校举办 [15][20]。当时只有 12 人参会,大部分都是来自上述四所大学的代表 [16][21]。来自加州大学洛杉矶分校的研究生史蒂夫·克罗克(Steve Crocker)参加了这场会议。他告诉我,工作组首次会议的参会者清一色都是年轻人,最年长的可能要数会议主席埃尔默·夏皮罗(Elmer Shapiro)了,他当年 38 岁左右。高级研究计划署没有安排负责研究计算机连接之后如何进行通信的人员,但是很明显它需要提供一定的协助。随着工作组会议的陆续开展,克罗克一直期望着更有经验与威望的“法定成年人”从东海岸飞过来接手这项工作,但是期望终究还是落空了。在高级研究计划署的默许之下,工作组举办了多场会议,其中包括很多长途旅行,差旅费由计划署报销,这些就是计划署给与工作组的全部协助了 [17][22]。
|
||||
|
||||
当时,国际网络工作组面临着巨大的挑战。组内成员都没有使用通用方式连接计算机系统的经验,而且这本来就与上世纪六十年代末计算机领域盛行的全部观点相悖:
|
||||
|
||||
> 那个时候的主机就像是全世界唯一的一台计算机。即便是最简短的交流会话,两台主机也无法轻易做到。并不是说机器没办法相互连接,只是连接之后,两台计算机又能做些什么呢?当时,计算机和与其相连的其他设备之间的通讯,就像帝王与群臣之间的对话一般。连接到主机的设备各自执行着自己的任务,每台外围设备都保持着常备不懈的状态,等待着上司的命令。当时的计算机就是严格按照这类交流需求设计出来的;它们向读卡器、终端与磁带机等下属设备发号施令,发起所有会话。但是,如果一台计算机拍了拍另一台计算机的肩膀,说道,“你好,我也是一台计算机”,那么另一台计算机可就傻眼了,什么也回答不上来 [18][23]。
|
||||
于是,工作组的最初进展比较缓慢 [19][24]。直到 1970 年 6 月,也就是首次会议将近两年之后,工作组才为网络协议选定了一套官方规范 [20][25]。
|
||||
|
||||
到了 1972 年,在国际计算机通信会议上展示 ARPANET 的时候,所有的协议已经准备到位了。会议期间,这些协议运用到了国际象棋等情景之中。用户运行 `@e r` 命令(`@echo remote` 命令的缩写形式),可以指示 TIP 使用新远程登录虚拟终端协议提供的服务,通知远程主机回显用户输入的内容。接着,用户运行 `@L 134` 命令(`@login 134` 命令的缩写形式),让 TIP 在 134 号主机上调用<ruby>初始连接协议<rt>Initial Connection Protocol</rt></ruby>,该协议指示远程主机分配出连接所需的全部必要资源,并将用户带入远程登录会话中。上述文件传输的情景也许用到了 <ruby>文件传输协议<rt>File Transfer Protocol</rt></ruby>,而该协议恰好是在大会举办前夕才刚刚完成的 [21][26]。所有这些协议都是“三层”协议,其下的第二层是主机到主机层协议,定义了主机之间可以相互发送和接收的信息的基本格式;第一层是主机到接口通信处理机协议,定义了主机如何与连接的远程设备进行通信。令人感到不可思议的是,这些协议都能正常运行。
|
||||
|
||||
在我看来,网络工作组之所以能够在大会举办之前做好万全的准备,顺利且出色地完成任务,在于他们采用了开放且非正式的标准化方法,其中一个典型的例子就是著名的 Request for Comments(RFC)系列文档。RFC 文档最初通过传统邮件供工作组成员进行传阅,让成员们在没有举办会议的时候也能保持联系,同时收集成员反馈,汇集各方智慧。RFC 框架是克罗克提出的,他写出了第一篇 RFC 文档,并在早期负责管理 RFC 的邮寄列表。他这样做是为了强调工作组开放协作的活动本质。有了这套框架以及触手可及的文档,ARPANET 的协议设计过程成了一个大熔炉,每个人都可以贡献出自己的力量,步步推进,精益求精,让最棒的想法脱颖而出,使得每一位贡献者都值得尊敬。总而言之,RFC 获得了巨大成功,并且直至今天,长达半个世纪之后,它依旧是网络标准的“说明书”。
|
||||
|
||||
因此,说起 ARPANET 的影响力,我认为不得不强调的一点正是工作组留下的这一成果。今天,互联网可以把世界各地的人们连接起来,这也是它最神奇的属性之一。不过如果说这项技术到了上世纪才开始使用,那可就有些滑稽可笑了。要知道,在 ARPANET 出现之前,人们就已经通过电报打破了现实距离的限制。而 ARPANET 打破的应该是各个主机站点因使用不同的操作系统、字符编码、程序语言以及组织策略而在逻辑层面产生的差异限制。当然,不得不提的是,将第一个包交换网络投入使用在技术方面绝对是一大壮举。不过,在建立 ARPANET 网络过程中遇到的两大难题中,更为复杂的一项则是制定统一的标准并用以连接原本无法相互协作的计算机。而这一难题的解决方案,也成了 ARPANET 整个建立与发展历史中最为神奇的一个章节。
|
||||
|
||||
1981 年,高级研究计划署发表了一份“完工报告”,回顾了 ARPANET 项目的第一个十年。在《付出收获了回报的技术方面以及付出未能实现最初设想的技术方面》这一冗长的小标题下,作者们写道:
|
||||
|
||||
> 或许,在 ARPANET 的开发过程中,最艰难的一项任务就是,尽管主机制造商各不相同,或者同一制造商下操作系统各不相同,我们仍需在众多的独立主机系统之间实现通讯交流。好在这项任务后来取得了成功 [22][27]。
|
||||
你可以从美国联邦政府获得相关信息。
|
||||
|
||||
_如果你喜欢这篇文章,欢迎关注推特 [@TwoBitHistory][28],也可通过 [RSS feed][29] 订阅,获取最新文章。_
|
||||
|
||||
1. “Hilton Hotel Opens in Capital Today.” _The New York Times_, 20 March 1965, <https://www.nytimes.com/1965/03/20/archives/hilton-hotel-opens-in-capital-today.html?searchResultPosition=1>. Accessed 7 Feb. 2021. [↩︎][31]
|
||||
|
||||
2. James Pelkey. _Entrepreneurial Capitalism and Innovation: A History of Computer Communications 1968-1988,_ Chapter 4, Section 12, 2007, <http://www.historyofcomputercommunications.info/Book/4/4.12-ICCC%20Demonstration71-72.html>. Accessed 7 Feb. 2021. [↩︎][32]
|
||||
|
||||
3. Katie Hafner and Matthew Lyon. _Where Wizards Stay Up Late: The Origins of the Internet_. New York, Simon & Schuster, 1996, p. 178. [↩︎][33]
|
||||
|
||||
4. “International Conference on Computer Communication.” _Computer_, vol. 5, no. 4, 1972, p. c2, <https://www.computer.org/csdl/magazine/co/1972/04/01641562/13rRUxNmPIA>. Accessed 7 Feb. 2021. [↩︎][34]
|
||||
|
||||
5. “Program for the International Conference on Computer Communication.” _The Papers of Clay T. Whitehead_, Box 42, <https://d3so5znv45ku4h.cloudfront.net/Box+042/013_Speech-International+Conference+on+Computer+Communications,+Washington,+DC,+October+24,+1972.pdf>. Accessed 7 Feb. 2021. [↩︎][35]
|
||||
|
||||
6. 我其实并不清楚 ARPANET 是在哪个房间展示的。很多地方都提到了“宴会厅”,但是华盛顿希尔顿酒店更习惯于叫它“乔治敦”,而不是把它当成一间会议室。因此,或许这场展示是在国际宴会厅举办的。但是 RFC 372 号文件又提到了预定“乔治敦”作为展示场地一事。华盛顿希尔顿酒店的楼层平面图可以点击 [此处][36] 查看。 [↩︎][37]
|
||||
|
||||
7. Hafner, p. 179. [↩︎][38]
|
||||
|
||||
8. ibid., p. 178. [↩︎][39]
|
||||
|
||||
9. Bob Metcalfe. “Scenarios for Using the ARPANET.” _Collections-Computer History Museum_, <https://www.computerhistory.org/collections/catalog/102784024>. Accessed 7 Feb. 2021. [↩︎][40]
|
||||
|
||||
10. Hafner, p. 176. [↩︎][41]
|
||||
|
||||
11. Robert H. Thomas. “Planning for ACCAT Remote Site Operations.” BBN Report No. 3677, October 1977, <https://apps.dtic.mil/sti/pdfs/ADA046366.pdf>. Accessed 7 Feb. 2021. [↩︎][42]
|
||||
|
||||
12. Hafner, p. 12. [↩︎][43]
|
||||
|
||||
13. Joy Lisi Rankin. _A People’s History of Computing in the United States_. Cambridge, MA, Harvard University Press, 2018, p. 84. [↩︎][44]
|
||||
|
||||
14. Rankin, p. 93. [↩︎][45]
|
||||
|
||||
15. Steve Crocker. Personal interview. 17 Dec. 2020. [↩︎][46]
|
||||
|
||||
16. 克罗克将会议记录文件发给了我,文件列出了所有的参会者。[↩︎][47]
|
||||
|
||||
17. Steve Crocker. Personal interview. [↩︎][48]
|
||||
|
||||
18. Hafner, p. 146. [↩︎][49]
|
||||
|
||||
19. “Completion Report / A History of the ARPANET: The First Decade.” BBN Report No. 4799, April 1981, <https://walden-family.com/bbn/arpanet-completion-report.pdf>, p. II-13. [↩︎][50]
|
||||
|
||||
20. 这里我指的是 RFC 54 号文件中的“官方协议”。[↩︎][51]
|
||||
|
||||
21. Hafner, p. 175. [↩︎][52]
|
||||
|
||||
22. “Completion Report / A History of the ARPANET: The First Decade,” p. II-29. [↩︎][53]
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2021/02/07/arpanet.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[aREversez](https://github.com/aREversez)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://twobithistory.org
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://en.wikipedia.org/wiki/ARPANET
|
||||
[2]: tmp.pnPpRrCI3S#fn:1
|
||||
[3]: tmp.pnPpRrCI3S#fn:2
|
||||
[4]: tmp.pnPpRrCI3S#fn:3
|
||||
[5]: tmp.pnPpRrCI3S#fn:4
|
||||
[6]: tmp.pnPpRrCI3S#fn:5
|
||||
[7]: tmp.pnPpRrCI3S#fn:6
|
||||
[8]: tmp.pnPpRrCI3S#fn:7
|
||||
[9]: tmp.pnPpRrCI3S#fn:8
|
||||
[10]: https://archive.computerhistory.org/resources/access/text/2019/07/102784024-05-001-acc.pdf
|
||||
[11]: tmp.pnPpRrCI3S#fn:9
|
||||
[12]: tmp.pnPpRrCI3S#fn:10
|
||||
[13]: tmp.pnPpRrCI3S#fn:11
|
||||
[14]: tmp.pnPpRrCI3S#fn:12
|
||||
[15]: tmp.pnPpRrCI3S#fn:13
|
||||
[16]: tmp.pnPpRrCI3S#fn:14
|
||||
[17]: https://twobithistory.org/2018/05/27/semantic-web.html
|
||||
[18]: https://twobithistory.org/2018/12/18/rss.html
|
||||
[19]: https://twobithistory.org/2020/01/05/foaf.html
|
||||
[20]: tmp.pnPpRrCI3S#fn:15
|
||||
[21]: tmp.pnPpRrCI3S#fn:16
|
||||
[22]: tmp.pnPpRrCI3S#fn:17
|
||||
[23]: tmp.pnPpRrCI3S#fn:18
|
||||
[24]: tmp.pnPpRrCI3S#fn:19
|
||||
[25]: tmp.pnPpRrCI3S#fn:20
|
||||
[26]: tmp.pnPpRrCI3S#fn:21
|
||||
[27]: tmp.pnPpRrCI3S#fn:22
|
||||
[28]: https://twitter.com/TwoBitHistory
|
||||
[29]: https://twobithistory.org/feed.xml
|
||||
[30]: https://twitter.com/TwoBitHistory/status/1277259930555363329?ref_src=twsrc%5Etfw
|
||||
[31]: tmp.pnPpRrCI3S#fnref:1
|
||||
[32]: tmp.pnPpRrCI3S#fnref:2
|
||||
[33]: tmp.pnPpRrCI3S#fnref:3
|
||||
[34]: tmp.pnPpRrCI3S#fnref:4
|
||||
[35]: tmp.pnPpRrCI3S#fnref:5
|
||||
[36]: https://www3.hilton.com/resources/media/hi/DCAWHHH/en_US/pdf/DCAWH.Floorplans.Apr25.pdf
|
||||
[37]: tmp.pnPpRrCI3S#fnref:6
|
||||
[38]: tmp.pnPpRrCI3S#fnref:7
|
||||
[39]: tmp.pnPpRrCI3S#fnref:8
|
||||
[40]: tmp.pnPpRrCI3S#fnref:9
|
||||
[41]: tmp.pnPpRrCI3S#fnref:10
|
||||
[42]: tmp.pnPpRrCI3S#fnref:11
|
||||
[43]: tmp.pnPpRrCI3S#fnref:12
|
||||
[44]: tmp.pnPpRrCI3S#fnref:13
|
||||
[45]: tmp.pnPpRrCI3S#fnref:14
|
||||
[46]: tmp.pnPpRrCI3S#fnref:15
|
||||
[47]: tmp.pnPpRrCI3S#fnref:16
|
||||
[48]: tmp.pnPpRrCI3S#fnref:17
|
||||
[49]: tmp.pnPpRrCI3S#fnref:18
|
||||
[50]: tmp.pnPpRrCI3S#fnref:19
|
||||
[51]: tmp.pnPpRrCI3S#fnref:20
|
||||
[52]: tmp.pnPpRrCI3S#fnref:21
|
||||
[53]: tmp.pnPpRrCI3S#fnref:22
|
@ -0,0 +1,173 @@
|
||||
[#]: subject: "7 summer book recommendations from open source enthusiasts"
|
||||
[#]: via: "https://opensource.com/article/22/6/2022-opensourcecom-summer-reading-list"
|
||||
[#]: author: "Joshua Allen Holm https://opensource.com/users/holmja"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
来自开源爱好者的 7 本读物推荐
|
||||
======
|
||||
Opensource.com 社区的成员推荐这些书籍,涵盖了从有趣的悬疑小说到发人深省的非小说作品的各种类型,你一定能从中找到一本你想看的书!
|
||||
|
||||
![Ceramic mug of tea or coffee with flowers and a book in front of a window][1]
|
||||
|
||||
很高兴能为大家介绍 Opensource.com 的 2022 年暑期阅读清单。今年的榜单包含来自 Opensource.com 社区成员的 7 本精彩的读物推荐。你可以发现各种各样的书籍,涵盖从有趣舒适的谜团到探索发人深省主题的非小说类作品。我希望你能在这个榜单中找到感兴趣的书本。
|
||||
|
||||
请享受吧!
|
||||
|
||||
![Book title 97 Things Every Java Programmer Should Know][4]
|
||||
|
||||
**[《每个 Java 程序员都应该知道的 97 件事》:专家的集体智慧,作者:Kevlin Henney 和 Trisha Gee][5]**
|
||||
(97 Things Every Java Programmer Should Know: Collective Wisdom from the Experts, edited by Kevlin Henney and Trisha Gee)
|
||||
|
||||
*[由 Seth Kenlon 推荐][6]*
|
||||
|
||||
这本书是由 73 位在软件行业工作的不同作者共同撰写。它的优秀之处在于它不仅仅适用于 Java 编程。当然,有些章节会涉及 Java,但是也还有一些其他话题,例如了解你的容器环境、如何更快更好地交付软件、以及无论使用哪种语言都不要隐藏适用于开发的工具。
|
||||
|
||||
更好的是,有些章节同样适用于生活中的问题。将问题和任务分成小的部分是解决任何问题的好建议;建立多元化的团队对所有合作者都很重要;由从散乱的一块块拼图到拼好的完成品中,得到拼图玩家的思想如何应用于不同的工作角色。
|
||||
|
||||
每章只有几页,总共有 97 个章节,你可以轻松跳过不适用于你自己的章节。无论你是一直在写 Java 代码、或者只是学过一点 Java,亦或是尚未开始学习 Java,对于对代码和软件开发过程感兴趣的极客来说,这都会是一本好书。
|
||||
|
||||
![Book title A City is Not a Computer][7]
|
||||
|
||||
**[《城市不是计算机:其他的城市智能》,作者:Shannon Mattern][8]**
|
||||
(A City is Not a Computer: Other Urban Intelligences, by Shannon Mattern)
|
||||
|
||||
*[由 Scott Nesbitt 推荐][9]*
|
||||
|
||||
如今,让一切变得智能已经成为一种 *时尚*:我们的手机、家用电器、手表、汽车,甚至是城市都变得智能化了。
|
||||
|
||||
对于城市的智能化,这意味着传感器变得无处不在,在我们开展业务时收集数据,并根据这些数据向我们推送信息(无论数据有用与否)。
|
||||
|
||||
这就引出了一个问题,将所有高科技技术嵌入到城市中是否会使得城市智能化呢?在《城市不是计算机》这本书中,作者 Shannon Mattern 认为并不是这样的。
|
||||
|
||||
城市智能化的目标之一是为市民提供服务和更好的城市参与感。Mattern 指出,但是实际上,智慧城市希望将技术专家的管理想法与公共服务相融合,从而将公民重新设置为‘消费者’和‘用户’,然而,这并不是在鼓励公民积极参与城市的生活和治理。
|
||||
|
||||
第二个问题是关于智慧城市收集的数据。我们不知道收集了什么数据,以及收集了多少数据。我们也不知道这些数据使用在什么地方,以及是谁使用的。收集的数据太多了,以至于处理数据的市政工作人员会不堪重负。他们无法处理所有数据,因此他们专注于短期容易实现的任务,而忽略了更深层次和更紧迫的问题。这绝对达不到在推广智慧城市时所承诺的目标:智慧城市将成为解决城市困境的良药。
|
||||
|
||||
《城市不是计算机》是一篇短小精悍、经过深入研究的、反对拥抱智慧城市的议论文。这本书让我们思考智慧城市的真正目的:要让百姓真正受益于城市智能化,并引发我们的思考:发展智慧城市是否必要呢。
|
||||
|
||||
![Book title git sync murder][10]
|
||||
|
||||
**[《git sync 谋杀》,作者:Michael Warren Lucas][11]**
|
||||
(git sync murder, by Michael Warren Lucas)
|
||||
|
||||
*[由 Joshua Allen Holm 推荐][12]*
|
||||
|
||||
Dale Whitehead 宁愿呆在家里,通过他的电脑终端与世界连接,尤其是在他参加的最后一次会议上发生的事情之后。在那次会议上,Dale 扮演了一个业余侦探的角色,要解决一桩谋杀案。你可以在本系列的第一本书《git commit 谋杀(git commit murder)》中阅读这个故事。
|
||||
|
||||
现在,Dale 回到家,并参加了另一个会议,他再次发现自己成为了侦探。在《git sync 谋杀(git sync murder)》中,Dale 参加了一个当地科技会议,会议上发现一具尸体。这是谋杀,还是只是一场意外?现在,Dale 是这些问题的“专家”,他发现自己被卷入了这件事,并要亲自去弄清楚到底发生了什么。再多说的话就剧透了,所以我能说《git sync 谋杀》这本书十分引人入胜,而且读起来很有趣。不必先阅读《git commit 谋杀(git commit murder)》,才能阅读《git sync 谋杀》,但我强烈推荐一起阅读该系列中的这两本书。
|
||||
|
||||
作者 Michael Warren Lucas 的“git 谋杀”系列非常适合喜欢悬疑小说的科技迷。Lucas 写过很多复杂的技术题材的书,这本书也延续了他的技术题材,《git sync 谋杀》这本书中的人物在会议活动上谈论技术话题。如果你因为新冠疫情,最近没有参加过会议,错过了参会体验的话,Lucas 将带你参加一个技术会议,其中还有一个谋杀之谜以待解决。Dale Whitehead 是一个有趣的业余侦探,我相信大多数 Opensource.com 的读者会喜欢和 Dale 一起参加技术会议,并充当侦探破解谜案的。
|
||||
|
||||
![Book title Kick Like a Girl][13]
|
||||
|
||||
**[《像女孩一样踢球》, 作者:Melissa Di Donato Roos][14]**(Kick Like a Girl)
|
||||
|
||||
*[由 Joshua Allen Holm 推荐][15]*
|
||||
|
||||
没有人喜欢被孤立,当女孩 Francesca 想在公园里踢足球时,她也是这样。男孩们不会和她一起玩,因为她是女孩,所以她不高兴地回家了。她的母亲通过讲述有重要影响力的著名女性的故事来安慰她。《像女孩一样踢球》中详述的历史人物包括历史中来自许多不同领域的女性。读者将了解 Frida Kahlo、Madeleine Albright、Ada Lovelace、Rosa Parks、Amelia Earhart、Marie Curie、Valentina Tereshkova、Florence Nightingale 和 Malala Yousafzai 的故事。听完这些鼓舞人心的人物故事后,Francesca 回到公园,向男孩们发起了一场足球挑战。
|
||||
|
||||
《像女孩一样踢球》这本书的特色是作者 Melissa Di Donato Roos(SUSE(译注:SUSE是一家总部位于德国的软件公司,创立于1992年,以提供企业级Linux为主要业务)的 CEO)引人入胜的写作和 Ange Allen 的出色插图。这本书非常适合年轻读者,他们会喜欢押韵的文字和书中的彩色插图。Melissa Di Donato Roos 还写了另外两本童书,《美人鱼如何便便(How Do Mermaids Poo?)》和《魔盒(The Magic Box)》,这两本书也都值得一读。
|
||||
|
||||
![Book title Mine!][16]
|
||||
|
||||
**[《这是我的!:所有权的潜规则如何控制着我们的生活》, 作者:Michael Heller 和 James Salzman][17]**
|
||||
(Mine!: How the Hidden Rules of Ownership Control Our Lives)
|
||||
|
||||
*[由 Bryan Behrenshausen 推荐][18]*
|
||||
|
||||
作者 Michael Heller 和 James Salzman 在文章《这是我的!》中写道:“你对所有权的很多了解都是错误的”。这是一种被吸引到开源领域的人不得不接受所有权规则的对抗性邀请。这本书是为开源爱好者而写的,他们对代码、思想、各种知识产权的所有权的看法往往与主流观点和普遍接受的认知不同。在本书中,Heller 和 Salzman 列出了“所有权的隐藏规则”,这些规则管理着谁能控制对什么事物的访问。这些所有权规则是微妙的、强大的、有着深刻的历史惯例。这些所有权规则已经变得如此普遍,以至于看起来无可争议,这是因为“先到先得”或“种瓜得瓜,种豆得豆”的规则已经成为陈词滥调。然而,我们看到它们无处不在:在飞机上,为宝贵的腿部空间而战;在街道上,邻居们为铲好雪的停车位发生争执;在法庭上,陪审团决定谁能控制你的遗产和你的 DNA。在当下的数字时代,所有权的替代理论能否为重新思考基本权利创造空间?作者认为这是可以的。如果这是正确的,我们可能会回应:在未来,开源软件能否成为所有权运作的模型呢?
|
||||
|
||||
![Book Title Not All Fairy Tales Have Happy Endings][19]
|
||||
|
||||
**[并非所有童话故事都有幸福的结局:雪乐山公司(Sierra On-Line)的兴衰, 作者:Ken Williams][20]**
|
||||
(Not All Fairy Tales Have Happy Endings: The Rise and Fall of Sierra On-Line)
|
||||
|
||||
*[由 Joshua Allen Holm 推荐][21]*
|
||||
|
||||
在 1980 年代和 1990 年代,雪乐山公司(Sierra On-Line)是计算机软件行业的巨头。这家由 Ken 和 Roberta Williams 创立的公司,出身并不起眼,但却发布了许多标志性的电脑游戏。King's Quest、Space Quest、Quest for Glory、Leisure Suit Larry 和 Gabriel Knight 只是该公司版权中的很小一部分。
|
||||
|
||||
《并非所有童话故事都有幸福的结局》这本书,涵盖了从雪乐山公司发布第一款游戏 [Mystery House][22],到该公司不幸地被 CUC International 收购以及后续的所有内容。Sierra 品牌在被收购后仍会存活了一段时间,但 Williams 创立的 Sierra 已不复存在。Ken Williams 以只有他能做到的方式,讲述了雪乐山公司的整个历史。Sierra 的历史叙述穿插在 Williams 提出的管理和计算机编程建议的章节之中。虽然 Ken Williams 在写这本书时,已经离开这个行业很多年了,但他的建议仍然非常重要。
|
||||
|
||||
虽然雪乐山公司已不复存在,但该公司对计算机游戏行业产生了持久的影响。对于任何对计算机软件历史感兴趣的人来说,《并非所有童话故事都有美好的结局》都是值得一读的。雪乐山公司在其鼎盛时期处于游戏开发的最前沿,从带领公司走过那个激动人心的岁月的 Ken Williams 身上,我们可以学到许多宝贵的经验。
|
||||
|
||||
![Book title The Soul of a New Machine][23]
|
||||
|
||||
**[《新机器的灵魂》, 作者:Tracy Kidder][24]**(The Soul of a New Machine)
|
||||
|
||||
*[由 Guarav Kamathe 推荐][25]*
|
||||
|
||||
我是计算机历史的狂热读者。知道这些人们如此依赖(并且经常被认为是理所当然)的计算机是如何形成的,真是令人着迷!我是在 [Bryan Cantrill][27] 的博客文章中,第一次听说 [《新机器的灵魂》][26] (The Soul of a New Machine)这本书的。这是一本由 [Tracy Kidder][29] 编著的非小说类书籍,于 1981 年出版,作者Tracy Kidder也因此获得了 [普利策奖][30]。故事发生在 1970 年代,想象一下你是负责设计 [下一代计算机][31] 工程团队中的一员。故事的背景是在通用数据公司(Data General Corporation),该公司当时是一家小型计算机供应商,正在与美国数字设备公司(Digital Equipment Corporation,简称DEC)的 32 位 VAX 计算机相竞争。这本书概述了通用数据公司内部的两个都想尝试设计新机器的竞争团队,是如何发生不和的。接下来,细致地描绘了随之展开的事件。这本书深入地讲述了相关工程师的思想、他们的工作环境、他们在此过程中面临的技术挑战、他们是如何克服这些困难的、以及压力如何影响到了他们的个人生活等等。任何想知道计算机是怎么制造出来的人都应该阅读这本书。
|
||||
|
||||
以上就是2022年的推荐阅读书目。它提供了很多非常棒的选择,我相信 Opensource.com 的读者能得到数小时发人深省的阅读时光。想获取更多书籍推荐,请查看我们历年的阅读书目。
|
||||
|
||||
* [2021 年 Opensource.com 推荐阅读书目][32]
|
||||
* [2020 年 Opensource.com 推荐阅读书目][33]
|
||||
* [2019 年 Opensource.com 推荐阅读书目][34]
|
||||
* [2018 年 Open Organization 推荐阅读书目][35]
|
||||
* [2016 年 Opensource.com 推荐阅读书目][36]
|
||||
* [2015 年 Opensource.com 推荐阅读书目][37]
|
||||
* [2014 年 Opensource.com 推荐阅读书目][38]
|
||||
* [2013 年 Opensource.com 推荐阅读书目][39]
|
||||
* [2012 年 Opensource.com 推荐阅读书目][40]
|
||||
* [2011 年 Opensource.com 推荐阅读书目][41]
|
||||
* [2010 年 Opensource.com 推荐阅读书目][42]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/2022-opensourcecom-summer-reading-list
|
||||
|
||||
作者:[Joshua Allen Holm][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/holmja
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/tea-cup-mug-flowers-book-window.jpg
|
||||
[2]: https://unsplash.com/@sixteenmilesout?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/tea?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://opensource.com/sites/default/files/2022-06/97_Things_Every_Java_Programmer_Should_Know_1.jpg
|
||||
[5]: https://www.oreilly.com/library/view/97-things-every/9781491952689/
|
||||
[6]: https://opensource.com/users/seth
|
||||
[7]: https://opensource.com/sites/default/files/2022-06/A_City_is_Not_a_Computer_0.jpg
|
||||
[8]: https://press.princeton.edu/books/paperback/9780691208053/a-city-is-not-a-computer
|
||||
[9]: https://opensource.com/users/scottnesbitt
|
||||
[10]: https://opensource.com/sites/default/files/2022-06/git_sync_murder_0.jpg
|
||||
[11]: https://mwl.io/fiction/crime#gsm
|
||||
[12]: https://opensource.com/users/holmja
|
||||
[13]: https://opensource.com/sites/default/files/2022-06/Kick_Like_a_Girl.jpg
|
||||
[14]: https://innerwings.org/books/kick-like-a-girl
|
||||
[15]: https://opensource.com/users/holmja
|
||||
[16]: https://opensource.com/sites/default/files/2022-06/Mine.jpg
|
||||
[17]: https://www.minethebook.com/
|
||||
[18]: https://opensource.com/users/bbehrens
|
||||
[19]: https://opensource.com/sites/default/files/2022-06/Not_All_Fairy_Tales.jpg
|
||||
[20]: https://kensbook.com/
|
||||
[21]: https://opensource.com/users/holmja
|
||||
[22]: https://en.wikipedia.org/wiki/Mystery_House
|
||||
[23]: https://opensource.com/sites/default/files/2022-06/The_Soul_of_a_New_Machine.jpg
|
||||
[24]: https://www.hachettebookgroup.com/titles/tracy-kidder/the-soul-of-a-new-machine/9780316204552/
|
||||
[25]: https://opensource.com/users/gkamathe
|
||||
[26]: https://en.wikipedia.org/wiki/The_Soul_of_a_New_Machine
|
||||
[27]: https://en.wikipedia.org/wiki/Bryan_Cantrill
|
||||
[28]: http://dtrace.org/blogs/bmc/2019/02/10/reflecting-on-the-soul-of-a-new-machine/
|
||||
[29]: https://en.wikipedia.org/wiki/Tracy_Kidder
|
||||
[30]: https://www.pulitzer.org/winners/tracy-kidder
|
||||
[31]: https://en.wikipedia.org/wiki/Data_General_Eclipse_MV/8000
|
||||
[32]: https://opensource.com/article/21/6/2021-opensourcecom-summer-reading-list
|
||||
[33]: https://opensource.com/article/20/6/summer-reading-list
|
||||
[34]: https://opensource.com/article/19/6/summer-reading-list
|
||||
[35]: https://opensource.com/open-organization/18/6/summer-reading-2018
|
||||
[36]: https://opensource.com/life/16/6/2016-summer-reading-list
|
||||
[37]: https://opensource.com/life/15/6/2015-summer-reading-list
|
||||
[38]: https://opensource.com/life/14/6/annual-reading-list-2014
|
||||
[39]: https://opensource.com/life/13/6/summer-reading-list-2013
|
||||
[40]: https://opensource.com/life/12/7/your-2012-open-source-summer-reading
|
||||
[41]: https://opensource.com/life/11/7/summer-reading-list
|
||||
[42]: https://opensource.com/life/10/8/open-books-opensourcecom-summer-reading-list
|
@ -1,135 +0,0 @@
|
||||
[#]: subject: (New ways to learn about open organizations)
|
||||
[#]: via: (https://opensource.com/open-organization/21/6/celebrate-sixth-anniversary)
|
||||
[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MareDevi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
了解开放组织的新途径
|
||||
======
|
||||
通过参与两个令人兴奋的新项目来庆祝开放组织社区的六周年。
|
||||
![][1]
|
||||
|
||||
6月2日,开放组织社区庆祝其成立六周年。这是六年来的文章([上百篇][2])、书籍([一系列][3])、对话([具有启发性][4])、教学(我们所[喜欢的][5])和学习。我们非常自豪地成为一个充满活力的开放专家和领导者的社区,致力于将[开放原则][6]带到大大小小的组织。事实上,许多[开放组织大使][7]以帮助他人变得更加开放为职业,我们的社区仍然致力于帮助各行业的领导者以开放的心态和行为融入他们的社区和环境中。
|
||||
|
||||
[去年][8]是开放组织项目的一个[成长][9]和[发展][10]时期。今年,我们将在这一势头的基础上继续努力。今天,我们很自豪地介绍两项新的倡议——当然,也邀请你的参加。
|
||||
|
||||
### 开启,调整,开放
|
||||
|
||||
首先,我们很高兴地宣布:我们社区的工作有了一个全新的场所。[OpenOrgTV][11]。这不仅仅是一个新的平台。它也是另一种媒介的实验:视频。
|
||||
|
||||
在我们的频道上,我们将举办各种对话--从深层次的书评到社区圆桌会议。首先,请查看"[Open Leadership Conversations][12]"系列,其中包括对某些富有洞察力的领导者的采访,提供他们对根据开放原则进行领导的意义的观点。或者观看"[问大使][13]",我们的Q&A式写作节目,由社区专家回答你关于组织文化和设计的问题。也想参与这个节目吗?在我们的[new dedicated forum][14]中向社区成员提交你的问题。
|
||||
|
||||
整个月,我们都会介绍 [开放组织大使][15],让您终于可以看到他们的面孔并听到您多年来阅读的故事、案例研究和采访背后的声音。
|
||||
|
||||
### 定义开放式领导
|
||||
|
||||
自从我们几年前发布它以来,[开放组织定义][16] 已成为更好地理解开放组织文化和设计本质的组织指导框架(并且我们已经做了很多工作来[教导其他人] [17])。 随着时间的推移,我们甚至开发了 [一个成熟度模型][18] 来操作该定义,因此组织可以评估自己的开放程度并制定具体计划以变得 _更加_ 开放。
|
||||
|
||||
现在,我们认为是时候将这项工作更进一步了。
|
||||
|
||||
但是,开放组织社区不仅仅是平台、工具或项目的任何组合。它是所有人都热情地一起工作,以帮助传播开放原则和实践。
|
||||
|
||||
受我们自己经验、[Red Hat][19]和[Mozilla][20]等开放组织已有的框架、多年研究和采访该领域的开放领袖的启发,以及我们对更好地理解开放领导力如何 _真正_ 发挥作用的渴望,我们很高兴公布一份全新文件的早期草案:开放领导力定义(the Open Leadership Definition)。
|
||||
|
||||
本文档概述了建立开放型组织并使其成为思想开放的人能够成长和茁壮成长的地方的各类领导者所特有的心态和行为。它建立在开放型组织定义的基础上,解释了开放型领导者如何体现和倡导开放型组织的特征,如透明度、包容性、适应性、协作性和社区性。
|
||||
|
||||
而且我们渴望与世界分享。
|
||||
|
||||
从今天开始(在接下来的两周内),我们将收集您对我们文件草案的见解和意见。我们渴望听到您的想法,并将接受您的意见的 _整体_ 或片段。您可以对文件的个别部分或整个文件提出意见。请查看下面的链接。我们期待着听到您的意见。
|
||||
|
||||
* * *
|
||||
|
||||
####
|
||||
|
||||
![Open Leadership Definition word cloud][21]
|
||||
|
||||
_Laura Hiliger 提供的的开放式领导定义词云 (CC BY-SA)_
|
||||
|
||||
#### 开放式领导定义
|
||||
|
||||
[Open Leadership: 简介][22]
|
||||
|
||||
[Open Leadership: 透明度][23]
|
||||
|
||||
[Open Leadership: 包容性][24]
|
||||
|
||||
[Open Leadership: 适应性][25]
|
||||
|
||||
[Open Leadership: 协作][26]
|
||||
|
||||
[Open Leadership: 社区][27]
|
||||
|
||||
在我们的共享文件夹中[阅读全文][28]
|
||||
* * *
|
||||
|
||||
### 联系我们
|
||||
|
||||
当然,你仍然可以在所有常见的地方找到我们的社区,如:
|
||||
|
||||
* [我们的项目网站][29], 您通往整个开放组织项目和社区的门户。
|
||||
* [我们的对话中心][4], 在这里你可以与社区成员互动,提出问题,了解新项目,寻找资源,并帮助他人。
|
||||
* [我们的 GitHub 组织][30],我们一直在公开研究新项目,并邀请您加入我们
|
||||
* [我们在Opensource.com的发表频道][2], 我们在这里为各地区和各行业的从业人员发布最新的分析、案例研究、访谈和资源。
|
||||
* 我们的 [Twitter][31] 和 [LinkedIn][32] 平台, 我们将在这里分享我们的最新进展,并促进新的对话。
|
||||
|
||||
|
||||
|
||||
但开放组织社区不仅仅是平台、工具或项目的任何组合。 是 _人_,所有人都热情地一起工作以帮助传播开放的原则和实践。正是这些人使我们的社区如此伟大。
|
||||
|
||||
六年来一直如此,并将永远保持下去。
|
||||
|
||||
### 从数字上看
|
||||
|
||||
![][33]
|
||||
|
||||
_Jen Kelchner提供的信息图表_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/21/6/celebrate-sixth-anniversary
|
||||
|
||||
作者:[Laura Hilliger][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MareDevi](https://github.com/MareDevi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/laurahilliger
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openorg_sixth_anniversary.png?itok=3RWyEk5S
|
||||
[2]: https://opensource.com/open-organization
|
||||
[3]: https://theopenorganization.org/books
|
||||
[4]: https://www.theopenorganization.community/
|
||||
[5]: https://www.youtube.com/watch?v=Snf6vICDbzw&list=PLLIYDJHuxOkaPEH76mIJe-HHplsiSAVej
|
||||
[6]: https://theopenorganization.org/definition
|
||||
[7]: https://theopenorganization.org/about
|
||||
[8]: https://opensource.com/open-organization/20/6/scaling-energetic-community
|
||||
[9]: https://opensource.com/open-organization/20/7/evolving-project-governance
|
||||
[10]: https://opensource.com/open-organization/20/8/open-community-rebrands
|
||||
[11]: http://theopenorganization.tv
|
||||
[12]: https://www.youtube.com/watch?v=07YBs0ss9rU&list=PLLIYDJHuxOkYDTLbKRjcd9THTFtpnK8lh
|
||||
[13]: https://www.youtube.com/watch?v=ukkZMYqRuUQ&list=PLLIYDJHuxOkY1gDbOFLDxGxwwmxeOATrI
|
||||
[14]: https://www.theopenorganization.community/c/ask-community/19
|
||||
[15]: http://theopenorganization.org/roster/
|
||||
[16]: https://theopenorganization.org/definition/
|
||||
[17]: https://youtu.be/NYngFYGgxro
|
||||
[18]: https://github.com/open-organization/open-org-maturity-model
|
||||
[19]: https://github.com/red-hat-people-team/red-hat-multiplier
|
||||
[20]: https://mozilla.github.io/open-leadership-framework/framework/#the-open-leadership-framework
|
||||
[21]: https://opensource.com/sites/default/files/images/open-org/open_leadership_word_cloud.png (Open Leadership Definition word cloud)
|
||||
[22]: https://docs.google.com/document/d/1blmf94ED_p4BHGv0luU_XrU26aF7tCzV6WTmh_v-PDY/edit?usp=sharing
|
||||
[23]: https://docs.google.com/document/d/14ssBBL0h2vxU0WZoMnWs6eo_8oRfJhnAr5yr-fAiLGU/edit?usp=sharing
|
||||
[24]: https://docs.google.com/document/d/1lRutADes5E0mcwtc6GR_Qw06PuJLc9-wUK5W1Gcf_BA/edit?usp=sharing
|
||||
[25]: https://docs.google.com/document/d/1RcwWTpkT42bgkf6EPiECt8LyAJ1XZjNGhzk0cQuBB7c/edit?usp=sharing
|
||||
[26]: https://docs.google.com/document/d/1hTvnpqQkOc76-0UJbV6tAvRxOE--bdt96mqGmAKGqiI/edit?usp=sharing
|
||||
[27]: https://docs.google.com/document/d/1Zl1smi-4jDZNNWd0oNY8qRH-GDi9q5VfvgyZ7YLkvm4/edit?usp=sharing
|
||||
[28]: https://drive.google.com/drive/folders/1e1N_0p5lJEwAo_s6hQ3OK0KaJIfc7fgF?usp=sharing
|
||||
[29]: http://theopenorganization.org/
|
||||
[30]: https://github.com/open-organization
|
||||
[31]: https://twitter.com/openorgproject
|
||||
[32]: https://www.linkedin.com/company/the-open-organization/
|
||||
[33]: https://opensource.com/sites/default/files/images/open-org/openorgproject_6_anniversary_stats.png
|
@ -0,0 +1,528 @@
|
||||
[#]: subject: "Python Microservices Using Flask on Kubernetes"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/09/python-microservices-using-flask-on-kubernetes/"
|
||||
[#]: author: "Krishna Mohan Koyya https://www.opensourceforu.com/author/krishna-mohan-koyya/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
在 Kubernetes 上使用 Flask 的 Python 微服务
|
||||
======
|
||||
|
||||
![Python 微服务][6]
|
||||
|
||||
*微服务遵循领域驱动设计(DDD),与开发平台无关。Python 微服务也不例外。Python3 的面向对象特性使得按照 DDD 对服务进行建模变得更加容易。本系列的第 10 部分演示了如何将用户管理系统的查找服务作为 Python 微服务部署在 Kubernetes 上。*
|
||||
|
||||
微服务架构的强大之处在于它的多语言性。企业将其功能分解为一组微服务,每个团队自由选择一个平台。
|
||||
|
||||
我们的用户管理系统已经分解为四个微服务,分别是添加、查找、搜索和日志服务。添加服务在 Java 平台上开发并部署在 Kubernetes 集群上,以实现弹性和可扩展性。这并不意味着其余的服务也要使用 Java 开发,我们可以自由选择适合个人服务的平台。
|
||||
|
||||
让我们选择 Python 作为开发查找服务的平台。查找服务的模型已经设计好了(参考 2022 年 3 月份的文章),我们只需要将这个模型转换为代码和配置。
|
||||
|
||||
### Pythonic 方法
|
||||
|
||||
Python 是一种通用编程语言,已经存在了大约 30 年。早期,它是自动化脚本的首选。然而,随着 Django 和 Flask 等框架的出现,它的受欢迎程度越来越高,现在各种领域中都在应用它,如企业应用程序开发。数据科学和机器学习进一步推动了它的发展,Python 现在是三大编程语言之一。
|
||||
|
||||
许多人将 Python 的成功归功于它容易编码。这只是一部分原因。只要你的目标是开发小型脚本,Python 就像一个玩具,你会非常喜欢它。然而,当你进入严肃的大规模应用程序开发领域时,你将不得不处理大量的 if 和 else,Python 变得与任何其他平台一样好或一样坏。例如,采用一种面向对象的方法!许多 Python 开发人员甚至可能没意识到 Python 支持类、继承等功能。Python 确实支持成熟的面向对象开发,但是有它自己的方式 -- Pythonic!让我们探索一下!
|
||||
|
||||
### 领域模型
|
||||
|
||||
添加服务通过将数据保存到一个 MySQL 数据库中来将用户添加到系统中。查找服务的目标是提供一个 REST API 按用户名查找用户。域模型如图 1 所示。它主要由一些值对象组成,如用户实体的用户名、电话以及 UserRepository。
|
||||
|
||||
![图 1: 查找服务的域模型][1]
|
||||
|
||||
让我们从用户名开始。由于它是一个值对象,因此必须在创建时进行验证,并且必须保持不可变。基本结构如所示:
|
||||
|
||||
```python
|
||||
class Name:
|
||||
value: str
|
||||
def __post_init__(self):
|
||||
if self.value is None or len(self.value.strip()) < 8 or len(self.value.strip()) > 32:
|
||||
raise ValueError("Invalid Name")
|
||||
```
|
||||
|
||||
如你所见,用户名包含一个字符串类型的值。作为后期初始化的一部分,我们会验证它。
|
||||
|
||||
Python 3.7 提供了 @dataclass 装饰器,它提供了许多开箱即用的数据承载类的功能,如构造函数、比较运算符等。如下是装饰后的 Name 类:
|
||||
|
||||
```python
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Name:
|
||||
value: str
|
||||
def __post_init__(self):
|
||||
if self.value is None or len(self.value.strip()) < 8 or len(self.value.strip()) > 32:
|
||||
raise ValueError("Invalid Name")
|
||||
```
|
||||
|
||||
以下代码可以创建一个 Name 对象:
|
||||
|
||||
```python
|
||||
name = Name("Krishna")
|
||||
```
|
||||
|
||||
value 属性可以按照如下方式读取或写入:
|
||||
|
||||
```python
|
||||
name.value = "Mohan"
|
||||
print(name.value)
|
||||
```
|
||||
|
||||
可以很容易地与另一个 Name 对象比较,如下所示:
|
||||
|
||||
```python
|
||||
other = Name("Mohan")
|
||||
if name == other:
|
||||
print("same")
|
||||
```
|
||||
|
||||
如你所见,对象比较的是值而不是引用。这一切都是开箱即用的。我们还可以通过冻结对象使对象不可变。这是 Name 值对象的最终版本:
|
||||
|
||||
```python
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Name:
|
||||
value: str
|
||||
def __post_init__(self):
|
||||
if self.value is None or len(self.value.strip()) < 8 or len(self.value.strip()) > 32:
|
||||
raise ValueError("Invalid Name")
|
||||
```
|
||||
|
||||
电话也遵循类似的方法,因为它也是一个值对象:
|
||||
|
||||
```python
|
||||
@dataclass(frozen=True)
|
||||
class PhoneNumber:
|
||||
value: int
|
||||
def __post_init__(self):
|
||||
if self.value < 9000000000:
|
||||
raise ValueError("Invalid Phone Number")
|
||||
```
|
||||
|
||||
用户类是一个实体,不是一个值对象。换句话说,用户是可变的。以下是结构:
|
||||
|
||||
```python
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
|
||||
@dataclass
|
||||
class User:
|
||||
_name: Name
|
||||
_phone: PhoneNumber
|
||||
_since: datetime.datetime
|
||||
|
||||
def __post_init__(self):
|
||||
if self._name is None or self._phone is None:
|
||||
raise ValueError("Invalid user")
|
||||
if self._since is None:
|
||||
self.since = datetime.datetime.now()
|
||||
```
|
||||
|
||||
你能观察到用户并没有冻结,因为我们希望它是可变的。但是,我们不希望所有属性都是可变的。标识字段如 _name 和 _since 是希望不会修改的。那么,这如何做到呢?
|
||||
|
||||
Python3 提供了所谓的描述符协议,它会帮助我们正确定义 getters 和 setters。让我们使用 @property 装饰器将 getter 添加到 User 的所有三个字段中。
|
||||
|
||||
```python
|
||||
@property
|
||||
def name(self) -> Name:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def phone(self) -> PhoneNumber:
|
||||
return self._phone
|
||||
|
||||
@property
|
||||
def since(self) -> datetime.datetime:
|
||||
return self._since
|
||||
```
|
||||
|
||||
电话字段的 setter 可以使用 @<字段>.setter 来装饰:
|
||||
|
||||
```python
|
||||
@phone.setter
|
||||
def phone(self, phone: PhoneNumber) -> None:
|
||||
if phone is None:
|
||||
raise ValueError("Invalid phone")
|
||||
self._phone = phone
|
||||
```
|
||||
|
||||
通过重写 \_\_str\_\_() 函数,也可以为 User 提供一个简单的打印方法:
|
||||
|
||||
```python
|
||||
def __str__(self):
|
||||
return self.name.value + " [" + str(self.phone.value) + "] since " + str(self.since)
|
||||
```
|
||||
|
||||
这样,域模型的实体和值对象就准备好了。创建异常类如下所示:
|
||||
|
||||
```python
|
||||
class UserNotFoundException(Exception):
|
||||
pass
|
||||
```
|
||||
|
||||
域模型现在只剩下 UserRepository 了。Python 提供了一个名为 abc 的有用模块来创建抽象方法和抽象类。因为 UserRepository 只是一个接口,所以我们可以使用 abc 模块。
|
||||
|
||||
任何继承自 abc.ABC 的类都将变为抽象类,任何带有 @abc.abstractmethod 装饰器的函数都会变为一个抽象函数。下面是 UserRepository 的结构:
|
||||
|
||||
```python
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class UserRepository(ABC):
|
||||
@abstractmethod
|
||||
def fetch(self, name:Name) -> User:
|
||||
pass
|
||||
```
|
||||
|
||||
UserRepository 遵循仓储模式。换句话说,它在 User 实体上提供适当的 CRUD 操作,而不会暴露底层数据存储语义。在本例中,我们只需要 fetch() 操作,因为查找服务只查找用户。
|
||||
|
||||
因为 UserRepository 是一个抽象类,我们不能从抽象类创建实例对象。创建对象必须依赖于一个具体类实现这个抽象类。数据层 UserRepositoryImpl 提供了 UserRepository 的具体实现:
|
||||
|
||||
```
|
||||
class UserRepositoryImpl(UserRepository):
|
||||
def fetch(self, name:Name) -> User:
|
||||
pass
|
||||
```
|
||||
|
||||
由于添加服务将用户数据存储在一个 MySQL 数据库中,因此 UserRepositoryImpl 也必须连接到相同的数据库去检索数据。下面是连接到数据库的代码。主要,我们正在使用 MySQL 的连接库。
|
||||
|
||||
```python
|
||||
from mysql.connector import connect, Error
|
||||
|
||||
class UserRepositoryImpl(UserRepository):
|
||||
def fetch(self, name:Name) -> User:
|
||||
try:
|
||||
with connect(
|
||||
host="mysqldb",
|
||||
user="root",
|
||||
password="admin",
|
||||
database="glarimy",
|
||||
) as connection:
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute("SELECT * FROM ums_users where name=%s", (name.value,))
|
||||
row = cursor.fetchone()
|
||||
if cursor.rowcount == -1:
|
||||
raise UserNotFoundException()
|
||||
else:
|
||||
return User(Name(row[0]), PhoneNumber(row[1]), row[2])
|
||||
except Error as e:
|
||||
raise e
|
||||
```
|
||||
|
||||
在上面的片段中,我们使用 root 用户,admin 密码连接到一个名为 mysqldb 的数据库服务器,使用名为 glarimy 的数据库(模式)。在演示代码中是可以包含这些信息的,但在生产中不建议这么做,因为这会暴露敏感信息。
|
||||
|
||||
fetch() 操作的逻辑非常直观,它对 ums_users 表执行 SELECT 查询。回想一下,添加服务正在将用户数据写入同一个表中。如果 SELECT 查询没有返回记录,fetch() 函数将抛出 UserNotFoundException 异常。否则,它会从记录中构造 User 实体并将其返回给调用者。这没有什么特殊的。
|
||||
|
||||
### 应用层
|
||||
|
||||
最终,我们需要创建应用层。此模型如图 2 所示。它只包含两个类:控制器和一个 DTO。
|
||||
|
||||
![图 2: 添加服务的应用层][2]
|
||||
|
||||
众所周知,一个 DTO 只是一个没有任何业务逻辑的数据容器。它主要用于在查找服务和外部服务之间传输数据。我们只是提供了在 REST 层中将 UserRecord 转换为字典以便用于 JSON 传输:
|
||||
|
||||
```python
|
||||
class UserRecord:
|
||||
def toJSON(self):
|
||||
return {
|
||||
"name": self.name,
|
||||
"phone": self.phone,
|
||||
"since": self.since
|
||||
}
|
||||
```
|
||||
|
||||
控制器的工作是将 DTO 转换为用于域服务的域对象,反之亦然。可以从 find() 操作中观察到这一点。
|
||||
|
||||
```python
|
||||
class UserController:
|
||||
|
||||
def __init__(self):
|
||||
self._repo = UserRepositoryImpl()
|
||||
|
||||
def find(self, name: str):
|
||||
try:
|
||||
user: User = self._repo.fetch(Name(name))
|
||||
record: UserRecord = UserRecord()
|
||||
record.name = user.name.value
|
||||
record.phone = user.phone.value
|
||||
record.since = user.since
|
||||
return record
|
||||
except UserNotFoundException as e:
|
||||
return None
|
||||
```
|
||||
|
||||
find() 操作接收一个字符串作为用户名,然后将其转换为 Name 对象,并调用 UserRepository 获取相应的 User 对象。如果找到了,则使用检索到的 User 对象创建 UserRecord。回想一下,将域对象转换为 DTO 是很有必要的,这样可以对外部服务隐藏域模型。
|
||||
|
||||
UserController 不需要有多个实例,它也可以是单例的。通过重写 \_\_new\_\_,可以将其建模为一个单例。
|
||||
|
||||
```python
|
||||
class UserController:
|
||||
def __new__(self):
|
||||
if not hasattr(self, ‘instance’):
|
||||
self.instance = super().__new__(self)
|
||||
return self.instance
|
||||
|
||||
def __init__(self):
|
||||
self._repo = UserRepositoryImpl()
|
||||
|
||||
def find(self, name: str):
|
||||
try:
|
||||
user: User = self._repo.fetch(Name(name))
|
||||
record: UserRecord = UserRecord()
|
||||
record.name = user.name.getValue()
|
||||
record.phone = user.phone.getValue()
|
||||
record.since = user.since
|
||||
return record
|
||||
except UserNotFoundException as e:
|
||||
return None
|
||||
```
|
||||
|
||||
我们已经完全实现了查找服务的模型,剩下的唯一任务是将其作为 REST 服务公开。
|
||||
|
||||
### REST API
|
||||
|
||||
查找服务只提供一个 API,那就是通过用户名查找用户。显然 URI 如下所示:
|
||||
|
||||
```
|
||||
GET /user/{name}
|
||||
```
|
||||
|
||||
此 API 希望根据提供的用户名查找用户,并以 JSON 格式返回用户的电话号码等详细信息。如果没有找到用户,API 将返回一个 404 状态码。
|
||||
|
||||
我们可以使用 Flask 框架来构建 REST API,它最初的目的是使用 Python 开发 Web 应用程序。除了 HTML 视图,它还进一步扩展到支持 REST 视图。我们选择这个框架是因为它足够简单。
|
||||
创建一个 Flask 应用程序:
|
||||
|
||||
```python
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
```
|
||||
|
||||
然后为 Flask 应用程序定义路由,就像函数一样简单:
|
||||
|
||||
```python
|
||||
@app.route('/user/<name>')
|
||||
def get(name):
|
||||
pass
|
||||
```
|
||||
|
||||
注意 @app.route 映射到 API /user/<name>,与之对应的函数的 get()。
|
||||
|
||||
如你所见,每次用户访问 API 如 http://server:port/user/Krishna 时,都将调用这个 get() 函数。Flask 足够智能,可以从 URL 中提取 'Krishna' 作为用户名,并将其传递给 get() 函数。
|
||||
|
||||
get() 函数很简单。它要求控制器找到该用户,并将其与通常的 HTTP 头一起打包为 JSON 格式后返回。如果控制器返回 None,则 get() 函数返回合适的 HTTP 状态码。
|
||||
|
||||
```python
|
||||
from flask import jsonify, abort
|
||||
|
||||
controller = UserController()
|
||||
record = controller.find(name)
|
||||
if record is None:
|
||||
abort(404)
|
||||
else:
|
||||
resp = jsonify(record.toJSON())
|
||||
resp.status_code = 200
|
||||
return resp
|
||||
```
|
||||
|
||||
最后,我们需要 Flask 应用程序提供服务,可以使用 waitress 服务:
|
||||
|
||||
```python
|
||||
from waitress import serve
|
||||
serve(app, host="0.0.0.0", port=8080)
|
||||
```
|
||||
|
||||
在上面的片段中,应用程序在本地主机的 8080 端口上提供服务。
|
||||
最终代码如下所示:
|
||||
|
||||
```python
|
||||
from flask import Flask, jsonify, abort
|
||||
from waitress import serve
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/user/<name>')
|
||||
def get(name):
|
||||
controller = UserController()
|
||||
record = controller.find(name)
|
||||
if record is None:
|
||||
abort(404)
|
||||
else:
|
||||
resp = jsonify(record.toJSON())
|
||||
resp.status_code = 200
|
||||
return resp
|
||||
|
||||
serve(app, host="0.0.0.0", port=8080)
|
||||
```
|
||||
|
||||
### 部署
|
||||
|
||||
查询服务的代码已经准备完毕。除了 REST API 之外,它还有域模型、数据层和应用程序层。下一步是构建此服务,将其容器化,然后部署到 Kubernetes 上。此过程与部署其他服务妹有任何区别,但有一些 Python 特有的步骤。
|
||||
|
||||
在继续前进之前,让我们来看下文件夹和文件结构:
|
||||
|
||||
```bash
|
||||
+ ums-find-service
|
||||
+ ums
|
||||
- domain.py
|
||||
- data.py
|
||||
- app.py
|
||||
- Dockerfile
|
||||
- requirements.txt
|
||||
- kube-find-deployment.yml
|
||||
```
|
||||
|
||||
如你所见,整个工作文件夹都位于 ums-find-service 下,它包含了 ums 文件夹中的代码和一些配置文件,例如 Dockerfile、requirements.txt 和 kube-find-deployment.yml。
|
||||
|
||||
domain.py 包含域模型,data.py 包含 UserRepositoryImpl,app.py 包含剩余代码。我们已经阅读过代码了,现在我们来看看配置文件。
|
||||
|
||||
第一个是 requirements.txt,它声明了 Python 系统需要下载和安装的外部依赖项。我们需要用查找服务中用到的每个外部 Python 模块来填充它。如你所见,我们使用了 MySQL 连接器、Flask 和 Waitress 模块。因此,下面是 requirements.txt 的内容。
|
||||
|
||||
```
|
||||
Flask==2.1.1
|
||||
Flask_RESTful
|
||||
mysql-connector-python
|
||||
waitress
|
||||
```
|
||||
|
||||
第二步是在 Dockerfile 中声明一些必要显示(to 校正:这里不太理解该如何翻译),如下:
|
||||
|
||||
```
|
||||
FROM python:3.8-slim-buster
|
||||
|
||||
WORKDIR /ums
|
||||
ADD ums /ums
|
||||
ADD requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["python"]
|
||||
CMD ["/ums/app.py"]
|
||||
```
|
||||
|
||||
总的来说,我们使用 Python 3.8 作为基线,除了移动 requirements.txt 之外,我们还将代码从 ums 文件夹移动到 Docker 容器中对应的文件夹中。然后,我们指示容器运行 pip3 install 命令安装对应模块。最后,我们向外暴露 8080 端口(因为 waitress 运行在此端口上)。
|
||||
|
||||
为了运行此服务,我们指示容器使用使用以下命令:
|
||||
|
||||
```
|
||||
python /ums/app.py
|
||||
```
|
||||
|
||||
一旦 Dockerfile 准备完成,在 ums-find-service 文件夹中运行以下命令,创建 Docker 镜像:
|
||||
|
||||
```
|
||||
docker build -t glarimy/ums-find-service
|
||||
```
|
||||
|
||||
它会创建 Docker 镜像,可以使用以下命令查找镜像:
|
||||
|
||||
```
|
||||
docker images
|
||||
```
|
||||
|
||||
尝试将镜像推送到 Docker Hub,你也可以登录到 Docker。
|
||||
|
||||
```
|
||||
docker login
|
||||
docker push glarimy/ums-find-service
|
||||
```
|
||||
|
||||
最后一步是为 Kubernetes 部署构建清单。
|
||||
|
||||
在之前的文章中,我们已经介绍了如何建立 Kubernetes 集群、部署和使用服务的方法。我假设仍然使用之前文章中的 manifest 文件来部署添加服务、MySQL、Kafka 和 Zookeeper。我们只需要将以下内容添加到 kube-find-deployment.yml 文件中:
|
||||
|
||||
```
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ums-find-service
|
||||
labels:
|
||||
app: ums-find-service
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ums-find-service
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ums-find-service
|
||||
spec:
|
||||
containers:
|
||||
- name: ums-find-service
|
||||
image: glarimy/ums-find-service
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ums-find-service
|
||||
labels:
|
||||
name: ums-find-service
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 8080
|
||||
selector:
|
||||
app: ums-find-service
|
||||
```
|
||||
|
||||
上面 manifest 的第一部分声明了 glarimy/ums-find-service 镜像的查找服务,它包含三个副本。它还暴露 8080 端口。manifet 的后半部分声明了一个Kubernetes 服务作为查找服务部署的前端。请记住,在之前文章中,mysqldb 服务已经是上述清单的一部分了。
|
||||
|
||||
运行以下命令在 Kubernetes 集群上部署 manifest:
|
||||
|
||||
```
|
||||
kubectl create -f kube-find-deployment.yml
|
||||
```
|
||||
|
||||
部署完成后,可以使用以下命令验证容器组和服务:
|
||||
|
||||
```
|
||||
kubectl get services
|
||||
```
|
||||
|
||||
输出如图 3 所示:
|
||||
|
||||
![图 3: Kubernetes 服务][3]
|
||||
|
||||
它会列出集群上运行的所有服务。注意查找服务的外部 ip,使用 curl 调用此服务:
|
||||
|
||||
```
|
||||
curl http://10.98.45.187:8080/user/KrishnaMohan
|
||||
```
|
||||
|
||||
注意:10.98.45.187 对应查找服务,如图 3 所示。
|
||||
|
||||
如果我们使用添加服务创建一个名为 KrishnaMohan 的用户,那么上面的 curl 命令看起来如图 4 所示:
|
||||
|
||||
![图 4: 查找服务][4]
|
||||
|
||||
用户管理系统(UMS)的体系结构包含添加服务和查找服务,以及存储和消息传递所需的后端服务,如图 5 所示。可以看到终端用户使用 ums 添加服务的 IP 地址添加新用户,使用 ums 查找服务的 IP 地址查找已有用户。每个 Kubernetes 服务都由三个对应容器的节点支持。还要注意:同样的 mysqldb 服务用于存储和检索用户数据。
|
||||
|
||||
![图 5: UMS 的添加服务和查找服务][5]
|
||||
|
||||
### 其他服务
|
||||
|
||||
UMS 系统还包含两个服务:查找服务和日志服务。在本系列的下一部分中,我们将在 Node 平台上设计这些服务,并将它们部署到同一个 Kubernetes 集群,以演示多语言微服务架构的真正魅力。最后,我们将观察一些与微服务相关的设计模式。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/09/python-microservices-using-flask-on-kubernetes/
|
||||
|
||||
作者:[Krishna Mohan Koyya][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/krishna-mohan-koyya/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-1-The-domain-model-of-FindService-1.png
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-2-The-application-layer-of-FindService.png
|
||||
[3]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-3-Kubernetes-services-1.png
|
||||
[4]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-4-FindService.png
|
||||
[5]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Figure-5-UMS-with-AddService-and-FindService.png
|
||||
[6]: https://www.opensourceforu.com/wp-content/uploads/2022/08/Python-Microservices-1-696x477.jpg
|
@ -0,0 +1,327 @@
|
||||
[#]: subject: "How To Find Default Gateway IP Address In Linux And Unix From Commandline"
|
||||
[#]: via: "https://ostechnix.com/find-default-gateway-linux/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
在 Linux 和 Unix 中如何从命令行查找默认网关的 IP 地址
|
||||
======
|
||||
Linux 下查找网关或路由器 IP 地址的 5 种方法。
|
||||
|
||||
**网关**是一个节点或一个路由器,当连接到同一路由器时,它允许两个或多个 IP 地址不同的主机相互通信。如果没有网关,它们将无法相互通信。换句话说,网关充当接入点,将网络数据从本地网络传输到远程网络。在本指南中,我们将看到在 Linux 和 Unix 中从命令行找到默认网关的所有可能方法。
|
||||
|
||||
#### 内容
|
||||
|
||||
1. 在 Linux 中查找默认网关 1.1 使用 ip 命令查找默认网关 1.2 使用 route 命令显示默认网关 IP 地址 1.3 使用 netstat 命令查看网关 IP 地址 1.4 使用 routel 命令打印默认网关或路由器 IP 地址 1.5 从以太网配置文件中查找网关
|
||||
2. 总结
|
||||
|
||||
### 在 Linux 中查找默认网关
|
||||
|
||||
Linux 中有各种各样的命令行工具可用于查看网关 IP 地址。最常用的工具是:**ip**、**ss** 和 **netcat**。我们将通过示例了解如何使用每种工具查看默认网关。
|
||||
|
||||
#### 1. 使用 ip 命令查找默认网关
|
||||
|
||||
**ip** 命令用于显示和操作 Linux 中的路由、网络设备、接口和隧道。
|
||||
|
||||
要查找默认网关或路由器 IP 地址,只需运行:
|
||||
|
||||
```
|
||||
$ ip route
|
||||
```
|
||||
|
||||
或者:
|
||||
|
||||
```
|
||||
$ ip r
|
||||
```
|
||||
|
||||
或者:
|
||||
|
||||
```
|
||||
$ ip route show
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
default via 192.168.1.101 dev eth0 proto static metric 100
|
||||
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
|
||||
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.20 metric 100
|
||||
```
|
||||
|
||||
你从输出中看到了 **"default via 192.168.1.101"** 这一行吗?它就是默认网关。我的默认网关是 **192.168.1.101**。
|
||||
|
||||
你可以使用 **-4** 参数只**显示 IPv4 网关**:
|
||||
|
||||
```
|
||||
$ ip -4 route
|
||||
```
|
||||
|
||||
或者,使用 **`-6`** 参数只**显示 IPv6 网关**:
|
||||
|
||||
```
|
||||
$ ip -6 route
|
||||
```
|
||||
|
||||
如你所见,IP 地址和子网详细信息也一并显示了。如果你想只显示默认网关,排除所有其他细节,可以使用 `ip route` 搭配 **`awk`** 命令,如下所示。
|
||||
|
||||
使用 `ip route` 和 `grep` 查找默认网关 IP 地址,执行命令:
|
||||
|
||||
```(to 校正,此条命令原文无,怀疑是作者忘记加了)
|
||||
$ ip route | grep default
|
||||
```
|
||||
|
||||
使用 `ip route` 和 `awk` 命令打印网关地址,执行命令:
|
||||
|
||||
```(to 校正,译注:wsl1 上无输出结果,正常 Linux 发行版无问题)
|
||||
$ ip route | awk '/^default/{print $3}'
|
||||
```
|
||||
|
||||
或者:
|
||||
|
||||
```
|
||||
$ ip route show default | awk '{print $3}'
|
||||
```
|
||||
|
||||
这将只列出网关 IP:
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
192.168.1.101
|
||||
```
|
||||
|
||||
![使用 ip 命令列出默认网关][1]
|
||||
|
||||
你也可以使用 **[grep][2]** 命令配合 `ip route` 对默认网关进行过滤。
|
||||
|
||||
```
|
||||
$ ip route | grep default
|
||||
default via 192.168.1.101 dev eth0 proto static metric 100
|
||||
```
|
||||
|
||||
在最新的 Linux 发行版中,`ip route` 是查找默认网关 ip 地址的推荐命令。然而,你们中的一些人可能仍然在使用传统的工具,如 `route` 和 **`netstat`**。旧习难改,对吧?下面的部分将介绍如何在 Linux 中使用 `route` 和 `netstat` 命令确定网关。
|
||||
|
||||
#### 2. 使用 route 命令显示默认网关 IP 地址
|
||||
|
||||
**route** 命令用于在较老的 Linux 发行版中显示和操作路由表,如 RHEL 6、CentOS 6 等。
|
||||
|
||||
如果你正在使用较老的 Linux 发行版,你可以使用 `route` 命令来显示默认网关。
|
||||
|
||||
请注意,在最新的 Linux 发行版中,`route` 工具已被弃用,`ip route` 命令取而代之。如果你因为某些原因仍然想使用 `route`,你需要安装它。
|
||||
|
||||
首先,我们需要检查哪个包提供了 `route` 命令。为此,在基于 RHEL 的系统上运行以下命令:
|
||||
|
||||
```
|
||||
$ dnf provides route
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
net-tools-2.0-0.52.20160912git.el8.x86_64 : Basic networking tools
|
||||
Repo : @System
|
||||
Matched from:
|
||||
Filename : /usr/sbin/route
|
||||
|
||||
net-tools-2.0-0.52.20160912git.el8.x86_64 : Basic networking tools
|
||||
Repo : baseos
|
||||
Matched from:
|
||||
Filename : /usr/sbin/route
|
||||
```
|
||||
|
||||
如你所见,net-tools 包提供了 `route` 命令。所以,让我们使用以下命令来安装它:
|
||||
|
||||
```
|
||||
$ sudo dnf install net-tools
|
||||
```
|
||||
|
||||
现在,运行带有 `-n` 参数的 `route` 命令来显示 Linux 系统中的网关或路由器 IP 地址:
|
||||
|
||||
```
|
||||
$ route -n
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
Kernel IP routing table
|
||||
Destination Gateway Genmask Flags Metric Ref Use Iface
|
||||
0.0.0.0 192.168.1.101 0.0.0.0 UG 100 0 0 eth0
|
||||
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
|
||||
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
|
||||
```
|
||||
|
||||
![使用 route 命令显示默认网关 IP 地址][3]
|
||||
|
||||
如你所见,网关 IP 地址是 192.168.1.101。你还将在 Flags 下面看到两个字母 **UG**。字母 **U** 代表接口是 **UP**,**G** 表示网关。
|
||||
|
||||
#### 3. 使用 netstat 命令查看网关 IP 地址
|
||||
|
||||
**Netstat** 会输出 Linux 网络子系统的信息。使用 netstat 工具,我们可以在 Linux 和 Unix 系统中打印网络连接、路由表、接口统计信息、伪装连接和组播成员关系。
|
||||
|
||||
Netstat 是 net-tools 包的一部分,所以确保你已经在 Linux 系统中安装了它。使用以下命令在基于 RHEL 的系统中安装它:
|
||||
|
||||
```
|
||||
$ sudo dnf install net-tools
|
||||
```
|
||||
|
||||
使用 netstat 命令打印默认网关 IP 地址:
|
||||
|
||||
```
|
||||
$ netstat -rn
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
Kernel IP routing table
|
||||
Destination Gateway Genmask Flags MSS Window irtt Iface
|
||||
0.0.0.0 192.168.1.101 0.0.0.0 UG 0 0 0 eth0
|
||||
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
|
||||
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
|
||||
```
|
||||
|
||||
![使用 netstat 命令查看网关 IP 地址][4]
|
||||
|
||||
`netstat` 命令与 `route` 命令的输出信息相同。如上输出可知,网关的 IP 地址为 192.168.1.191,UG 表示网关连接的网卡(NIC)是有效的,G 表示网关。
|
||||
|
||||
请注意 `netstat` 也已弃用,建议使用 **ss** 命令代替 netstat。
|
||||
|
||||
#### 4. 使用 routel 命令打印默认网关或路由器 IP 地址
|
||||
|
||||
**routel** 是一个脚本,它以一种漂亮格式的输出路由。routel 脚本的输出让一些人认为比 `ip route` 列表更直观。
|
||||
|
||||
routel 脚本也是 net-tools 包的一部分。
|
||||
|
||||
打印默认网关或路由器 IP 地址,运行 routel 脚本,不带任何参数,如下所示:
|
||||
|
||||
```
|
||||
$ routel
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
target gateway source proto scope dev tbl
|
||||
default 192.168.1.101 static eth0
|
||||
172.17.0.0/ 16 172.17.0.1 kernel linkdocker0
|
||||
192.168.1.0/ 24 192.168.1.20 kernel link eth0
|
||||
127.0.0.0/ 8 local 127.0.0.1 kernel host lo local
|
||||
127.0.0.1 local 127.0.0.1 kernel host lo local
|
||||
127.255.255.255 broadcast 127.0.0.1 kernel link lo local
|
||||
172.17.0.1 local 172.17.0.1 kernel hostdocker0 local
|
||||
172.17.255.255 broadcast 172.17.0.1 kernel linkdocker0 local
|
||||
192.168.1.20 local 192.168.1.20 kernel host eth0 local
|
||||
192.168.1.255 broadcast 192.168.1.20 kernel link eth0 local
|
||||
::1 kernel lo
|
||||
::/ 96 unreachable lo
|
||||
::ffff:0.0.0.0/ 96 unreachable lo
|
||||
2002:a00::/ 24 unreachable lo
|
||||
2002:7f00::/ 24 unreachable lo
|
||||
2002:a9fe::/ 32 unreachable lo
|
||||
2002:ac10::/ 28 unreachable lo
|
||||
2002:c0a8::/ 32 unreachable lo
|
||||
2002:e000::/ 19 unreachable lo
|
||||
3ffe:ffff::/ 32 unreachable lo
|
||||
fe80::/ 64 kernel eth0
|
||||
::1 local kernel lo local
|
||||
fe80::d085:cff:fec7:c1c3 local kernel eth0 local
|
||||
```
|
||||
|
||||
![使用 routel 命令打印默认网关或路由器 IP 地址][5]
|
||||
|
||||
只打印默认网关,和 `grep` 命令配合,如下所示:
|
||||
|
||||
```
|
||||
$ routel | grep default
|
||||
default 192.168.1.101 static eth0
|
||||
```
|
||||
|
||||
#### 5. 从以太网配置文件中查找网关
|
||||
|
||||
如果你在 **[Linux 或 Unix 中配置了静态 IP 地址][6],你可以通过查看网络配置文件查看默认网关或路由器 IP 地址。
|
||||
|
||||
在基于 RPM 的系统上,如 Fedora、RHEL、CentOS、AlmaLinux 和 Rocky Linux 等,网络接口卡(简称 **NIC**)配置存储在 **/etc/sysconfig/network-scripts/** 目录下。
|
||||
|
||||
查找网卡的名称:
|
||||
|
||||
```
|
||||
# ip link show
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
2: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
|
||||
link/ether d2:85:0c:c7:c1:c3 brd ff:ff:ff:ff:ff:ff link-netnsid 0
|
||||
```
|
||||
|
||||
网卡名为 **eth0**。所以让我们打开这个 NIC 文件的网卡配置:
|
||||
|
||||
```
|
||||
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
DEVICE=eth0
|
||||
ONBOOT=yes
|
||||
UUID=eb6b6a7c-37f5-11ed-a59a-a0e70bdf3dfb
|
||||
BOOTPROTO=none
|
||||
IPADDR=192.168.1.20
|
||||
NETMASK=255.255.255.0
|
||||
GATEWAY=192.168.1.101
|
||||
DNS1=8.8.8.8
|
||||
```
|
||||
|
||||
如你所见,网关 IP 为 `192.168.1.101`。
|
||||
|
||||
在 Debian、Ubuntu 及其衍生版中,所有的网络配置文件都存储在 **/etc/network** 目录下。
|
||||
|
||||
```
|
||||
$ cat /etc/network/interfaces
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
auto ens18
|
||||
iface ens18 inet static
|
||||
address 192.168.1.150
|
||||
netmask 255.255.255.0
|
||||
gateway 192.168.1.101
|
||||
dns-nameservers 8.8.8.8
|
||||
```
|
||||
|
||||
请注意,此方法仅在手动配置 IP 地址时有效。对于启用 DHCP 的网络,需要按照前面的 4 种方法操作。
|
||||
|
||||
### 总结
|
||||
|
||||
在本指南中,我们列出了在 Linux 和 Unix 系统中找到默认网关的 5 种不同方法,我们还在每种方法中包含了显示网关/路由器 IP 地址的示例命令。希望它对你有所帮助。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/find-default-gateway-linux/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/wp-content/uploads/2022/09/Find-Default-Gateway-Using-ip-Command.png
|
||||
[2]: https://ostechnix.com/the-grep-command-tutorial-with-examples-for-beginners/
|
||||
[3]: https://ostechnix.com/wp-content/uploads/2022/09/Display-Default-Gateway-IP-Address-Using-route-Command.png
|
||||
[4]: https://ostechnix.com/wp-content/uploads/2022/09/View-Gateway-IP-Address-Using-netstat-Command.png
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/09/Print-Default-Gateway-IP-Address-Or-Router-IP-Address-Using-routel-Command.png
|
||||
[6]: https://ostechnix.com/configure-static-ip-address-linux-unix/
|
@ -1,102 +0,0 @@
|
||||
[#]: subject: "Get change alerts from any website with this open source tool"
|
||||
[#]: via: "https://opensource.com/article/22/9/changedetection-io-open-source-website-changes"
|
||||
[#]: author: "Leigh Morresi https://opensource.com/users/dgtlmoon"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
用这个开源工具从任何网站获取变化提醒
|
||||
======
|
||||
使用 changeetection.io 在网站发生变化或更新时获得提醒。
|
||||
|
||||
![Browser of things][1]
|
||||
|
||||
那一年是 2020 年,关于 COVID-19 的消息迅速涌来,每个人都感到完全被只是提供了不同程度的更新的类似新闻所淹没,。
|
||||
|
||||
但我需要知道的是,我的官方政府准则何时改变。最后,这就是对我来说最重要的事情。
|
||||
|
||||
无论关注的是大流行病还是最新的科技新闻,提前了解网站内容的变化都至关重要。
|
||||
|
||||
[changedetection.io][2] 项目为网站变更检测和通知提供了一个简单但强大的开源解决方案。它很容易设置,而且可以通知 70 多个不同的通知系统,如 Matrix、Mattermost、[Nextcloud][3]、[Signal][4]、[Zulip][5]、[Home Assistant][6]、电子邮件等等。它还能通知专有应用,如 Discord、Office365、Reddit、Telegram 和许多其他应用。
|
||||
|
||||
但 [changeetection.io][7] 并不只是局限于观察监测内容。你也可以监视 XML 和 JSON 源,它将建立一个 RSS 源,记录变化的网站。
|
||||
|
||||
由于其内置的 JSON 简单存储系统,不需要设置复杂的数据库来接收和存储信息。你可以[使用 Docker 镜像运行][8]或用 `pip` 安装它。该项目有一个[全面的维基帮助页][9],大多数常见的问题都有涵盖。
|
||||
|
||||
对于使用复杂 JavaScript 的网站,你可以用内置的 [Playwright 内容获取器][10]将你的 changeetection.io 安装到 Chromium 或 Chrome 浏览器。
|
||||
|
||||
运行后,在你的浏览器(默认情况下是 `http://localhost:5000`)中访问该应用。如果你的电脑可以从外部网络访问,你可以在**设置**中设置一个密码。
|
||||
|
||||
![change detection watch list][11]
|
||||
|
||||
提交你想监控的页面的 URL。有几个设置与如何过滤该网页有关。例如,你很可能不想知道一家公司在其网站页脚列出的股票价格何时发生变化,但你可能想知道他们在其博客上发布的新闻文章。
|
||||
|
||||
### 监控一个网站
|
||||
|
||||
想象一下,你想添加你最喜欢的网站 Opensource.com 进行监控。 你只想知道主要标注文章何时包含 “python” 一词,并且通过 Matrix 收到通知。
|
||||
|
||||
要做到这点,首先要使用**视觉选择器**工具。(这需要连接 **playwright** 浏览器界面)。
|
||||
|
||||
![Find an element to monitor][12]
|
||||
|
||||
**视觉选择器**工具会自动计算出针对内容的最佳 Xpath 或 CSS 过滤器。否则,你会从每天的页面更新中得到大量的噪音。
|
||||
|
||||
接下来,访问**过滤器和触发器**标签。
|
||||
|
||||
![Filters and triggers][13]
|
||||
|
||||
在 **CSS/JSON/XPATH 过滤器**区域(蓝色圆圈),你可以看到上一步自动生成的 CSS 过滤器。
|
||||
|
||||
有几个有用的过滤器,比如**移除元素**(适合移除嘈杂的元素),**忽略文本,触发/等待文本**,和**如果文本匹配则阻止变化检测**(用于等待一些文本消失,如“售罄”)。
|
||||
|
||||
在**触发/等待文本**(红色圆圈)中,输入你想监测的关键词。(在这个例子中是 “python”)。
|
||||
|
||||
最后一步是在**通知**选项卡中,你要在那里配置你想收到的通知。下面我使用 Matrix API 添加了一个 Matrix 房间作为通知目标。
|
||||
|
||||
![Notifications tab][14]
|
||||
|
||||
通知的 URL 的格式是 `matrixs://username:password@matrix.org/#/room/#room-name:matrix.org`。
|
||||
|
||||
然而,[t2Bot][15] 格式也被支持。这里有更多的 [Matrix 通知选项][16]。
|
||||
|
||||
就是这些了! 现在只要内容有变化,你就会通过 Matrix 收到信息。
|
||||
|
||||
### 还有更多
|
||||
|
||||
changedetection.io 还有很多东西。如果你喜欢调用一个自定义的 JSON API,你不需要使用通知的 API(使用 `jsons://` )。你还可以创建一个自定义的 HTTP 请求(POST 和 GET),在检查前执行 JavaScript(也许是为了预先填充一个用户名和密码的登录字段),以及更多有趣的功能,更多的功能将陆续推出。
|
||||
|
||||
不要再浏览网站,而是开始监测网络吧!
|
||||
|
||||
图片提供:(Leigh Morresi, CC BY-SA 4.0)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/changedetection-io-open-source-website-changes
|
||||
|
||||
作者:[Leigh Morresi][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/dgtlmoon
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/browser_desktop_website_checklist_metrics.png
|
||||
[2]: https://github.com/dgtlmoon/changedetection.io
|
||||
[3]: https://opensource.com/tags/nextcloud
|
||||
[4]: https://opensource.com/article/19/10/secure-private-messaging
|
||||
[5]: https://opensource.com/article/22/3/open-source-chat-zulip
|
||||
[6]: https://opensource.com/article/20/11/home-assistant
|
||||
[7]: https://github.com/dgtlmoon/changedetection.io
|
||||
[8]: https://github.com/dgtlmoon/changedetection.io#docker
|
||||
[9]: https://github.com/dgtlmoon/changedetection.io/wiki
|
||||
[10]: https://github.com/dgtlmoon/changedetection.io/wiki/Playwright-content-fetcher
|
||||
[11]: https://opensource.com/sites/default/files/2022-09/screenshot.png
|
||||
[12]: https://opensource.com/sites/default/files/2022-09/changedetect-osdc.png
|
||||
[13]: https://opensource.com/sites/default/files/2022-09/changedetect-filters-triggers.webp
|
||||
[14]: https://opensource.com/sites/default/files/2022-09/step3-notification-matrix.png
|
||||
[15]: https://t2bot.io/
|
||||
[16]: https://github.com/caronc/apprise/wiki/Notify_matrix
|
122
translated/tech/20221010 Xubuntu 22.10- Top New Features.md
Normal file
122
translated/tech/20221010 Xubuntu 22.10- Top New Features.md
Normal file
@ -0,0 +1,122 @@
|
||||
[#]: subject: "Xubuntu 22.10: Top New Features"
|
||||
[#]: via: "https://www.debugpoint.com/xubuntu-22-10-features/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Xubuntu 22.10:热门新功能
|
||||
======
|
||||
这是 Xubuntu 22.10 Kinetic Kudu 及其新功能的快速总结。
|
||||
|
||||
![Xubuntu 22.10 桌面][1]
|
||||
|
||||
质量需要时间来建立。它适用于生活的所有阶段,包括软件。
|
||||
|
||||
自 Xfce 4.16 发布以来,Xfce 4.17(开发版)已经被添加了许多新功能。这包括核心 Xfce、原生应用,GNOME 43、MATE 1.26 和 libadwaita。由于 Xfce 也是 GNOME 和 MATE 的组合,正确地合并和测试这些更改需要时间。
|
||||
|
||||
在 Xubuntu 22.10 Kinetic Kudu 版本中,你将体验到自 2020 年 12 月以来所做的所有改进:将近两年的错误修复和增强。
|
||||
|
||||
让我们快速查看一下时间表。目前,Xubuntu 22.10 beta 已经发布并正在测试中(本页末尾的 ISO 链接)。最终版本预计于 2022 年 10 月 20 日发布。
|
||||
|
||||
### Xubuntu 22.10 新功能
|
||||
|
||||
#### 核心更新和 GNOME 框架
|
||||
|
||||
Xubuntu 22.10 的核心是基于 Ubuntu 22.10 的 Linux Kernel 5.19。另外,Xfce 桌面版是 Xfce 4.17。
|
||||
|
||||
4.17 版本是一个开发标签,因为它是下一个大版本 Xfce 4.18 的垫脚石,该版本 [计划在今年圣诞节发布][2]。
|
||||
|
||||
让我们谈谈 GNOME 和相关应用。 Xubuntu 22.10 中的 Xfce 4.17 首次获得了带有 GNOME 43 更新的 libadwaita。这意味着默认的 GNOME 应用程序可以在 Xfce 桌面下正确呈现。
|
||||
|
||||
话虽如此,GNOME Software 43 在 Xubuntu 22.10 的 Xfce 桌面下看起来很棒。如果你将其与 Xfce 原生外观和带有 CSD/SSD(例如 Disk)的 GNOME 应用进行比较,它们看起来都很整洁。
|
||||
|
||||
我对 GNOME Software 43 在 Xfce 桌面下的 libadwaita/GTK4 渲染效果如此之好感到惊讶。
|
||||
|
||||
![在 Xubuntu 22.10 中一起使用三种不同的窗口][3]
|
||||
|
||||
#### Xfce 应用
|
||||
|
||||
Xfce 桌面带来了自己的原生应用集。在此版本中,所有应用都从 4.16 升级到 4.17 版本。
|
||||
|
||||
值得注意的变化包括 Xfce 面板获得了对任务列表插件的中键单击支持和托盘时钟中的二进制时间模式。pulse 音频插件引入了一个新的录音指示器,可以过滤掉多个按钮按下事件。
|
||||
|
||||
Thunar 文件管理器获得了大量的底层功能和错误修复。如果你将 Thunar 4.16 与 Thunar 4.17 进行比较,它是变化巨大的。更改包括更新的上下文菜单、路径栏、搜索、导航等。你可以在[此处][4]阅读 Thunar 的所有更改日志。
|
||||
|
||||
此外,截屏应用 screenshooter 默认支持 WebP。蓝牙管理器 Blueman 在系统托盘新增配置文件切换器并更新 Catfish 文件搜索工具。
|
||||
|
||||
这是 Xfce 应用版本的更新列表和指向其更改日志的链接(如果你想进一步挖掘)。
|
||||
|
||||
* Appfinder [4.17.0][5]
|
||||
* Catfish [4.16.4][6]
|
||||
* Mousepad [0.5.10][7]
|
||||
* Panel [4.17.3][8]
|
||||
* PulseAudio 插件 [0.4.4][9]
|
||||
* Ristretto [0.12.3][10]
|
||||
* Screenshooter [1.9.11][11]
|
||||
* Task Manager [1.5.4][12]
|
||||
* Terminal [1.0.4][13]
|
||||
* Thunar [4.17.9][14]
|
||||
|
||||
#### 外观和感觉
|
||||
|
||||
默认的 elementary-xfce 图标集(浅色和深色)得到了更新,带有额外的精美图标,让你的 Xfce 桌面焕然一新。默认的 Greybird GTK 主题对窗口装饰进行了必要的改进,并添加了 Openbox 支持。
|
||||
|
||||
你可能会注意到的重要且可见的变化之一是 ALT+TAB 外观。图标更大一些,眼睛更舒适,可以在深色背景下更快地切换窗口。
|
||||
|
||||
![在 Xubuntu 22.10 的 elementary-xfce 中更新的图标集示例][15]
|
||||
|
||||
![ALT TAB 有更大的图标][16]
|
||||
|
||||
上述更改使默认应用与基础 [Ubuntu 22.10 版本][17]保持一致。以下是 Xubuntu 22.10 中的更改概括。
|
||||
|
||||
### 概括
|
||||
|
||||
* Linux Kernel 5.19 和基于 Ubuntu 22.10
|
||||
* Xfce 桌面版 4.17
|
||||
* 原生应用全部更新到 4.17
|
||||
* 核心与 GNOME 43、libadwaita、GTK4 保持一致
|
||||
* MATE 应用程序升级到 1.26
|
||||
* Mozilla Firefox 网络浏览器 105.0
|
||||
* Thunderbird 邮件客户端 102.3
|
||||
* LibreOffice 7.4.4.2
|
||||
|
||||
### 总结
|
||||
|
||||
Xfce 桌面作为一个整体最关键的变化是在 4.18 版本中到来的。例如,最初的 Wayland 支持、更新的 glib 和 GTK 包。如果一切顺利,你可以在明年 4 月发布的 Xubuntu 中期待这些最好的变化。
|
||||
|
||||
最后,如果你想试用,可以从[这个页面][18]下载 beta 镜像。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/xubuntu-22-10-features/
|
||||
|
||||
作者:[Arindam][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://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2022/10/Xubuntu-22.10-Desktop-1024x563.jpg
|
||||
[2]: https://debugpointnews.com/xfce-4-18-announcement/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/10/Three-different-window-decorations-together-in-Xubuntu-22.10.jpg
|
||||
[4]: https://gitlab.xfce.org/xfce/thunar/-/blob/master/NEWS
|
||||
[5]: https://gitlab.xfce.org/xfce/xfce4-appfinder/-/blob/master/NEWS
|
||||
[6]: https://gitlab.xfce.org/apps/catfish/-/blob/master/NEWS
|
||||
[7]: https://gitlab.xfce.org/apps/mousepad/-/blob/master/NEWS
|
||||
[8]: https://gitlab.xfce.org/xfce/xfce4-panel/-/blob/master/NEWS
|
||||
[9]: https://gitlab.xfce.org/panel-plugins/xfce4-pulseaudio-plugin/-/blob/master/NEWS
|
||||
[10]: https://gitlab.xfce.org/apps/ristretto/-/blob/master/NEWS
|
||||
[11]: https://gitlab.xfce.org/apps/xfce4-screenshooter/-/blob/master/NEWS
|
||||
[12]: https://gitlab.xfce.org/apps/xfce4-taskmanager/-/blob/master/NEWS
|
||||
[13]: https://gitlab.xfce.org/apps/xfce4-terminal/-/blob/master/NEWS
|
||||
[14]: https://gitlab.xfce.org/xfce/thunar/-/blob/master/NEWS
|
||||
[15]: https://www.debugpoint.com/wp-content/uploads/2022/10/Refreshed-icon-set-sample-in-elementary-xfce-with-Xubuntu-22.10.jpg
|
||||
[16]: https://www.debugpoint.com/wp-content/uploads/2022/10/ALT-TAB-is-refreshed-with-larger-icons.jpg
|
||||
[17]: https://www.debugpoint.com/ubuntu-22-10/
|
||||
[18]: https://cdimage.ubuntu.com/xubuntu/releases/kinetic/beta/
|
@ -0,0 +1,146 @@
|
||||
[#]: subject: "How to Enable Snap Support in Arch Linux"
|
||||
[#]: via: "https://itsfoss.com/install-snap-arch-linux/"
|
||||
[#]: author: "Pranav Krishna https://itsfoss.com/author/pranav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 Arch Linux 中启用 Snap 支持
|
||||
======
|
||||
Snap 是由 Ubuntu 的母公司 Canonical 设计的通用包格式。有些人不喜欢 Snap,但它有一些优势。
|
||||
|
||||
通常,某些应用仅以 Snap 格式提供。这为你提供了在 Arch Linux 中启用 snap 的充分理由。
|
||||
|
||||
我知道 AUR 拥有大量应用,但 snap 应用通常直接来自开发人员。
|
||||
|
||||
如果你希望能够在 Arch Linux 中安装 Snap 应用,你需要先启用 snap 支持。
|
||||
|
||||
有两种方法可以做到:
|
||||
|
||||
* 使用 AUR 助手启用 Snap 支持(更简单)
|
||||
* 通过从 AUR 获取包手动启用 Snap 支持
|
||||
|
||||
让我们看看怎么做。
|
||||
|
||||
### 方法 1. 使用 AUR 助手启用 Snap
|
||||
|
||||
Snap 在 Arch 用户仓库中以 *snapd* 包的形式提供。你可以使用 AUR 助手轻松安装它。
|
||||
|
||||
存在[许多 AUR 助手][1],但 *yay* 是我更喜欢的,因为它的语法类似于 [pacman 命令][2]。
|
||||
|
||||
如果你还没有安装 AUR,请使用以下命令安装 Yay(需要事先 git):
|
||||
|
||||
```
|
||||
git clone https://aur.archlinux.org/yay
|
||||
|
||||
cd yay
|
||||
|
||||
makepkg -si
|
||||
```
|
||||
|
||||
![安装 yay][3]
|
||||
|
||||
现在 *yay* 已安装,你可以通过以下方式安装 snapd:
|
||||
|
||||
```
|
||||
yay -Sy snapd
|
||||
```
|
||||
|
||||
![使用 yay 从 AUR 安装 snapd][4]
|
||||
|
||||
每当你[更新 Arch Linux][5] 系统时,Yay 都会启用 snapd 的自动更新。
|
||||
|
||||
### 验证 snap 是否有效
|
||||
|
||||
要测试 snap 是否正常工作,请安装并运行 *hello-world* snap 包。
|
||||
|
||||
```
|
||||
sudo snap install hello-world
|
||||
|
||||
hello-world
|
||||
(或者)
|
||||
sudo snap run hello-world
|
||||
```
|
||||
|
||||
![hello-world snap 包执行][6]
|
||||
|
||||
如果它运行良好,那么你可以轻松安装其他 snap 包。
|
||||
|
||||
### 方法 2. 从 AUR 手动构建 snap 包
|
||||
|
||||
如果你不想使用 AUR 助手,你仍然可以从 AUR 获取 snap。让我展示详细的过程。
|
||||
|
||||
你需要先安装一些构建工具。
|
||||
|
||||
```
|
||||
sudo pacman -Sy git go go-tools python-docutils
|
||||
```
|
||||
|
||||
![为 snap 安装依赖项][7]
|
||||
|
||||
完成依赖项安装后,现在可以克隆 AUR 目录,如下所示:
|
||||
|
||||
```
|
||||
git clone https://aur.archlinux.org/snapd
|
||||
|
||||
cd snapd
|
||||
```
|
||||
|
||||
![克隆仓库][8]
|
||||
|
||||
然后构建 snapd 包:
|
||||
|
||||
```
|
||||
makepkg -si
|
||||
```
|
||||
|
||||
当它要求安装其他依赖包时输入 yes。
|
||||
|
||||
![手动构建 snapd][9]
|
||||
|
||||
你已安装 snapd 守护程序。但是,需要启用它以在启动时自动启动。
|
||||
|
||||
```
|
||||
sudo systemctl enable snapd --now
|
||||
|
||||
sudo systemctl enable snapd.apparmor --now #start snap applications
|
||||
|
||||
sudo ln -s /var/lib/snapd/snap /snap #optional: classic snap support
|
||||
```
|
||||
|
||||
![启动时启用 snap][10]
|
||||
|
||||
手动构建包的主要缺点是每次新更新启动时你都必须手动构建。使用 AUR 助手为我们解决了这个问题。
|
||||
|
||||
### 总结
|
||||
|
||||
我更喜欢 Arch Linux 中的 pacman 和 AUR。很少能看到不在 AUR 中但以其他格式提供的应用。尽管如此,在某些你希望直接从源获取它的情况下,使用 snap 可能是有利的,例如 [在 Arch 上安装 Spotify][11]。
|
||||
|
||||
希望本教程对您有所帮助。如果你有任何问题,请告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-snap-arch-linux/
|
||||
|
||||
作者:[Pranav Krishna][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://itsfoss.com/author/pranav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/best-aur-helpers/
|
||||
[2]: https://itsfoss.com/pacman-command/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/10/yay-makepkg.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/10/yay-install-snapd.png
|
||||
[5]: https://itsfoss.com/update-arch-linux/
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/10/snap-hello-world-1.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/10/snapd-manual-install-dependencies.png
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/10/snapd-manual-install-clone.png
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/10/snapd-manual-install-makepkg-800x460.png
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/10/enable-snapd-startup-2.png
|
||||
[11]: https://itsfoss.com/install-spotify-arch/
|
Loading…
Reference in New Issue
Block a user