mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-28 23:20:10 +08:00
commit
fc5382e3cc
@ -1,8 +1,8 @@
|
|||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: "zepoch"
|
[#]: translator: "zepoch"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-13542-1.html"
|
||||||
[#]: subject: "Use Python to solve a charity's business problem"
|
[#]: subject: "Use Python to solve a charity's business problem"
|
||||||
[#]: via: "https://opensource.com/article/20/9/solve-problem-python"
|
[#]: via: "https://opensource.com/article/20/9/solve-problem-python"
|
||||||
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||||
@ -10,19 +10,19 @@
|
|||||||
使用 Python 来解决慈善机构的业务问题
|
使用 Python 来解决慈善机构的业务问题
|
||||||
======
|
======
|
||||||
|
|
||||||
比较不同的编程语言如何解决同一个问题是一个很有趣的事情,也很有指导意义。接下来,我们就来讲一讲 Python。
|
> 比较不同的编程语言如何解决同一个问题是一个很有趣的事情,也很有指导意义。接下来,我们就来讲一讲如何用 Python 来解决。
|
||||||
![Python programming language logo with question marks][1]
|
|
||||||
|
|
||||||
在我这一系列的[第一篇文章][2]里,我描述了这样子的一个问题,如何将一大批的救助物资分为具有相同价值的物品,并将其分发给社区中的困难住户。我也曾写过用不同的编程语言写一些小程序来解决这样子的小问题以及比较这些程序时如何工作的。
|
![](https://img.linux.net.cn/data/attachment/album/202107/02/124241fzuzo7kflrf7g77v.jpg)
|
||||||
|
|
||||||
|
在我这一系列的 [第一篇文章][2] 里,我描述了这样子的一个问题,如何将一大批的救助物资分为具有相同价值的物品,并将其分发给社区中的困难住户。我也曾写过用不同的编程语言写一些小程序来解决这样子的小问题以及比较这些程序时如何工作的。
|
||||||
|
|
||||||
在第一篇文章中,我是使用了 [Groovy][3] 语言来解决问题的。Groovy 在很多方面都与 [Python][4] 很相似,但是在语法上她更像 C 语言和 Java。因此,使用 Python 来创造一个相同的解决方案应该会很有趣且更有意义。
|
在第一篇文章中,我是使用了 [Groovy][3] 语言来解决问题的。Groovy 在很多方面都与 [Python][4] 很相似,但是在语法上她更像 C 语言和 Java。因此,使用 Python 来创造一个相同的解决方案应该会很有趣且更有意义。
|
||||||
|
|
||||||
### 使用 Python 的解决方案
|
### 使用 Python 的解决方案
|
||||||
|
|
||||||
使用 Java 时,我会声明一个 utility 类来保存元组数据(新的特征记录器将会很好地解决这个问题)。使用 Groovy 时,我就是用了 maps 中的映射,我也将在 Python 使用相同的映射
|
使用 Java 时,我会声明一个工具类来保存元组数据(新的记录功能将会很好地用于这个需求)。使用 Groovy 时,我就是用了该语言的映射功能,我也将在 Python 使用相同的机制。
|
||||||
|
|
||||||
使用一个字典来保存从批发商处批发来的货物:
|
|
||||||
|
|
||||||
|
使用一个字典列表来保存从批发商处批发来的货物:
|
||||||
|
|
||||||
```
|
```
|
||||||
packs = [
|
packs = [
|
||||||
@ -43,18 +43,15 @@ packs = [
|
|||||||
{'item':'Soap','brand':'Sunny Day','units':6,'price':1794,'quantity':2}]
|
{'item':'Soap','brand':'Sunny Day','units':6,'price':1794,'quantity':2}]
|
||||||
```
|
```
|
||||||
|
|
||||||
大米有一包,每包中有 10 袋大米,意大利面条有十包,每包中有一袋意大利面条。上述代码中,变量 `packs` 被设置为 Python 字典列表。这与Groovy的方法非常相似。关于 Groovy 和 Python 之间的区别,有几点需要注意:
|
大米有一包,每包中有 10 袋大米,意大利面条有十包,每包中有一袋意大利面条。上述代码中,变量 `packs` 被设置为 Python 字典列表。这与 Groovy 的方法非常相似。关于 Groovy 和 Python 之间的区别,有几点需要注意:
|
||||||
|
|
||||||
1. 在 Python 中,无需关键字来定义变量 `packs`,Python 变量初始化时需要设置一个值。
|
|
||||||
2. Python 字典中的词键(例如,`item`, `brand`, `units`, `price`, `quantity`)需要引号来表明它们是字符串;Groovy 假定这些是字符串,但也接受引号。
|
|
||||||
3. 在 Python 中,符号 `{ ... }` 表明一个字典声明; Groovy 使用与列表相同的方括号,但两种情况下的结构都必须具有键值对。
|
|
||||||
|
|
||||||
|
|
||||||
|
1. 在 Python 中,无需关键字来定义变量 `packs`,Python 变量初始化时需要设置一个值。
|
||||||
|
2. Python 字典中的词键(例如,`item`、`brand`、`units`、`price`、 `quantity`)需要引号来表明它们是字符串;Groovy 假定这些是字符串,但也接受引号。
|
||||||
|
3. 在 Python 中,符号 `{ ... }` 表明一个字典声明; Groovy 使用与列表相同的方括号,但两种情况下的结构都必须具有键值对。
|
||||||
|
|
||||||
当然,表中的价格不是以美元计算的。
|
当然,表中的价格不是以美元计算的。
|
||||||
|
|
||||||
接下来,打开散装包。 例如,打开大米的单个散装包装,将产出 10 单位大米; 也就是说,产出的单位总数是`单位 * 数量`。 Groovy 脚本使用一个名为 `collectMany` 的方便的函数,该函数可用于展平列表列表。 据我所知,Python 没有类似的东西,所以使用两个列表推导式来产生相同的结果:
|
接下来,打开散装包。例如,打开大米的单个散装包装,将产出 10 单元大米; 也就是说,产出的单元总数是 `units * quantity`。 Groovy 脚本使用一个名为 `collectMany` 的方便的函数,该函数可用于展平列表列表。 据我所知,Python 没有类似的东西,所以使用两个列表推导式来产生相同的结果:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
units = [[{'item':pack['item'],'brand':pack['brand'],
|
units = [[{'item':pack['item'],'brand':pack['brand'],
|
||||||
@ -65,74 +62,52 @@ units = [x for sublist in units for x in sublist]
|
|||||||
|
|
||||||
第一个列表可理解为(分配给单元)构建字典列表列表。 第二个将其“扁平化”为字典列表。 请注意,Python 和 Groovy 都提供了一个 `*` 运算符,它接受左侧的列表和右侧的数字 `N`,并复制列表 `N` 次。
|
第一个列表可理解为(分配给单元)构建字典列表列表。 第二个将其“扁平化”为字典列表。 请注意,Python 和 Groovy 都提供了一个 `*` 运算符,它接受左侧的列表和右侧的数字 `N`,并复制列表 `N` 次。
|
||||||
|
|
||||||
后一步是将这些单位的大米之类的重新包装到 hamper 中以进行分发。 就像在 Groovy 版本中一样,您需要更具体地了解理想的 hamper 值,当您只剩下几个单位时,您最好不要过度限制,即可以做一些随机分配:
|
最后一步是将这些单元的大米之类的重新包装到篮子(`hamper`)中以进行分发。 就像在 Groovy 版本中一样,你需要更具体地了解理想的篮子数,当你只剩下几个单元时,你最好不要过度限制,即可以做一些随机分配:
|
||||||
|
|
||||||
|
```
|
||||||
```python
|
|
||||||
valueIdeal = 5000
|
valueIdeal = 5000
|
||||||
valueMax = valueIdeal * 1.1
|
valueMax = valueIdeal * 1.1
|
||||||
```
|
```
|
||||||
|
|
||||||
很好! 重新包装包裹。
|
很好! 重新打包篮子。
|
||||||
|
|
||||||
|
```
|
||||||
```python
|
|
||||||
import random
|
import random
|
||||||
hamperNumber = 0 # [1]
|
hamperNumber = 0 # 导入 Python 的随机数生成器工具并初始化篮子数
|
||||||
while len(units) > 0: # [2]
|
while len(units) > 0: # 只要有更多可用的单元,这个 `while` 循环就会将单元重新分配到篮子中:
|
||||||
hamperNumber += 1
|
hamperNumber += 1
|
||||||
hamper = []
|
hamper = []
|
||||||
value = 0
|
value = 0
|
||||||
canAdd = True # [2.1]
|
canAdd = True # 增加篮子编号,得到一个新的空篮子(单元的列表),并将其值设为 0; 开始假设你可以向篮子中添加更多物品。
|
||||||
while canAdd: # [2.2]
|
while canAdd: # 这个 `while` 循环将尽可能多地向篮子添加单元(Groovy 代码使用了 `for` 循环,但 Python 的 `for` 循环期望迭代某些东西,而 Groovy 则是为更传统的 C 形式的 `for` 循环形式):
|
||||||
u = random.randint(0,len(units)-1) # [2.2.1]
|
u = random.randint(0,len(units)-1) # 获取一个介于 0 和剩余单元数减 1 之间的随机数。
|
||||||
canAdd = False # [2.2.2]
|
canAdd = False # 假设你找不到更多要添加的单元。
|
||||||
o = 0 # [2.2.3]
|
o = 0 # 创建一个变量,用于从你正在寻找要放入篮子中的物品的起点的偏移量。
|
||||||
while o < len(units): # [2.2.4]
|
while o < len(units): # 从随机选择的索引开始,这个 `while` 循环将尝试找到一个可以添加到篮子的单元(再次注意,Python `for` 循环可能不适合这里,因为列表的长度将在迭代中中发生变化)。
|
||||||
uo = (u + o) % len(units)
|
uo = (u + o) % len(units)
|
||||||
unit = units[uo]
|
unit = units[uo]
|
||||||
unitPrice = unit['price'] # [2.2.4.1]
|
unitPrice = unit['price'] # 找出要查看的单元(随机起点+偏移量)并获得其价格。
|
||||||
if len(units) < 3 or not (unit in hamper) and (value + unitPrice) < valueMax:
|
if len(units) < 3 or not (unit in hamper) and (value + unitPrice) < valueMax:
|
||||||
# [2.2.4.2]
|
# 如果只剩下几个,或者添加单元后篮子的价值不太高,你可以将此单元添加到篮子中。
|
||||||
hamper.append(unit)
|
hamper.append(unit)
|
||||||
value += unitPrice
|
value += unitPrice
|
||||||
units.pop(u) # [2.2.4.3]
|
units.pop(u) # 将单元添加到篮子中,按单价增加 篮子数,从可用单元列表中删除该单元。
|
||||||
canAdd = len(units) > 0
|
canAdd = len(units) > 0
|
||||||
break # [2.2.4.4]
|
break # 只要还有剩余单元,你就可以添加更多单元,因此可以跳出此循环继续寻找。
|
||||||
o += 1 # [2.2.4.5]
|
o += 1 # 增加偏移量。
|
||||||
# [2.2.5]
|
# 在退出这个 `while` 循环时,如果你检查了所有剩余的单元并且找不到单元可以添加到篮子中,那么篮子就完成了搜索; 否则,你找到了一个,可以继续寻找更多。
|
||||||
print('')
|
print('')
|
||||||
print('Hamper',hamperNumber,'value',value)
|
print('Hamper',hamperNumber,'value',value)
|
||||||
for item in hamper:
|
for item in hamper:
|
||||||
print('%-25s%-25s%7.2f' % (item['item'],item['brand'],item['price'])) # [2.3]
|
print('%-25s%-25s%7.2f' % (item['item'],item['brand'],item['price'])) # 打印出篮子的内容。
|
||||||
print('Remaining units',len(units)) # [2.4]
|
print('Remaining units',len(units)) # 打印出剩余的单元信息。
|
||||||
```
|
```
|
||||||
|
|
||||||
一些澄清,上面注释中括号中的数字(例如,_[1]_)对应于以下澄清:
|
一些澄清如上面的注释。
|
||||||
|
|
||||||
* 1\. 导入 Python 的随机数生成器工具并初始化 hampers 数。
|
|
||||||
* 2\. 只要有更多可用的单元,这个`while` 循环就会将单元重新分配到 hampers 中:
|
|
||||||
* 2.1 增加 hamper 编号,得到一个新的空hamper(单位列表),并将其值设为0; 开始假设您可以向 hamper 中添加更多物品。
|
|
||||||
* 2.2 这个 `while` 循环将尽可能多地向 Hamper 添加单元(Groovy 代码使用了 `for` 循环,但 Python 的 `for` 循环期望迭代某些东西,而 Groovy 则是为更传统的 C 形式的 `for` 循环形式):
|
|
||||||
* 2.2.1 获取一个介于 0 和剩余单位数减 1 之间的随机数。
|
|
||||||
* 2.2.2 假设您找不到更多要添加的单位。
|
|
||||||
* 2.2.3 创建一个变量,用于从您正在寻找要放入 hamper 中的物品的起点的偏移量。
|
|
||||||
* 2.2.4 从随机选择的索引开始,这个 `while` 循环将尝试找到一个可以添加到 hamper 的单元(再次注意,Python `for` 循环可能不适合这里,因为列表的长度将在迭代中中发生变化)。
|
|
||||||
* 2.2.4.1 找出要查看的单位(随机起点+偏移量)并获得其价格。
|
|
||||||
* 2.2.4.2 如果只剩下几个,或者添加单位后篮子的价值不太高,您可以将此单位添加到 Hamper 中。
|
|
||||||
* 2.2.4.3 将单位添加到 Hamper 中,按单价增加 Hamper 价值,从可用单位列表中删除该单位。
|
|
||||||
* 2.2.4.4 只要还有剩余单位,您就可以添加更多单位,因此可以跳出此循环继续寻找。
|
|
||||||
* 2.2.4.5 增加偏移量,。
|
|
||||||
* 2.2.5 在退出这个 `while` 循环时,如果你检查了所有剩余的单元并且找不到单元可以添加到 hamper 中,那么 hamper 就完成了搜索; 否则,您找到了一个,可以继续寻找更多。
|
|
||||||
* 2.3 打印出 hamper 的内容。
|
|
||||||
* 2.4 打印出剩余的单位信息。
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
运行此代码时,输出看起来与 Groovy 程序的输出非常相似:
|
运行此代码时,输出看起来与 Groovy 程序的输出非常相似:
|
||||||
|
|
||||||
|
```
|
||||||
```python
|
|
||||||
Hamper 1 value 5304.0
|
Hamper 1 value 5304.0
|
||||||
UHT milk Atlantic 760.00
|
UHT milk Atlantic 760.00
|
||||||
Tomato sauce Best Family 190.00
|
Tomato sauce Best Family 190.00
|
||||||
@ -162,7 +137,7 @@ Spaghetti Best Family 327.00
|
|||||||
Lentils Southern Style 1189.00
|
Lentils Southern Style 1189.00
|
||||||
Remaining units 135
|
Remaining units 135
|
||||||
|
|
||||||
…
|
...
|
||||||
|
|
||||||
Hamper 21 value 5145.0
|
Hamper 21 value 5145.0
|
||||||
Tomato sauce Best Family 190.00
|
Tomato sauce Best Family 190.00
|
||||||
@ -182,17 +157,17 @@ Rice Best Family 565.00
|
|||||||
Remaining units 0
|
Remaining units 0
|
||||||
```
|
```
|
||||||
|
|
||||||
最后一个 hamper 在内容和价值上有所简化。
|
最后一个篮子在内容和价值上有所简化。
|
||||||
|
|
||||||
### 结论
|
### 结论
|
||||||
|
|
||||||
乍一看,这个程序的 Python 和 Groovy 版本之间没有太大区别。 两者都有一组相似的结构,这使得处理列表和字典非常简单。 两者都不需要很多“样板代码”或其他“繁杂”操作。
|
乍一看,这个程序的 Python 和 Groovy 版本之间没有太大区别。 两者都有一组相似的结构,这使得处理列表和字典非常简单。 两者都不需要很多“样板代码”或其他“繁杂”操作。
|
||||||
|
|
||||||
此外,使用 Groovy 时,向 Hamper 中添加单元还是一件比较繁琐的事情。 您需要在单位列表中随机选择一个位置,然后从该位置开始,遍历列表,直到找到一个价格允许的且包含它的单位,或者直到您用完列表为止。 当只剩下几件物品时,您需要将它们扔到最后一个 Hamper 里。
|
此外,使用 Groovy 时,向篮子中添加单元还是一件比较繁琐的事情。 你需要在单元列表中随机选择一个位置,然后从该位置开始,遍历列表,直到找到一个价格允许的且包含它的单元,或者直到你用完列表为止。 当只剩下几件物品时,你需要将它们扔到最后一个篮子里。
|
||||||
|
|
||||||
另一个值得一提的问题是:这不是一种特别有效的方法。 从列表中删除元素、极其多的重复表达式还有一些其它的问题使得这不太适合解决这种大数据重新分配问题。 尽管如此,它仍然在我的老机器上运行。
|
另一个值得一提的问题是:这不是一种特别有效的方法。 从列表中删除元素、极其多的重复表达式还有一些其它的问题使得这不太适合解决这种大数据重新分配问题。 尽管如此,它仍然在我的老机器上运行。
|
||||||
|
|
||||||
如果你觉得我在这段代码中使用 `while` 循环并改变其中的数据感到不舒服,您可能希望我让它更有用一些。 我想不出一种方法不使用 Python 中的 map 和 reduce 函数,并结合随机选择的单元进行重新打包。 你可以吗?
|
如果你觉得我在这段代码中使用 `while` 循环并改变其中的数据感到不舒服,你可能希望我让它更有用一些。 我想不出一种方法不使用 Python 中的 map 和 reduce 函数,并结合随机选择的单元进行重新打包。 你可以吗?
|
||||||
|
|
||||||
在下一篇文章中,我将使用 Java 重新执行此操作,以了解 Groovy 和 Python 的工作量减少了多少,未来的文章将介绍 Julia 和 Go。
|
在下一篇文章中,我将使用 Java 重新执行此操作,以了解 Groovy 和 Python 的工作量减少了多少,未来的文章将介绍 Julia 和 Go。
|
||||||
|
|
||||||
@ -203,7 +178,7 @@ via: https://opensource.com/article/20/9/solve-problem-python
|
|||||||
作者:[Chris Hermansen][a]
|
作者:[Chris Hermansen][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[zepoch](https://github.com/zepoch)
|
译者:[zepoch](https://github.com/zepoch)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,199 @@
|
|||||||
|
[#]: subject: (Use open source tools to set up a private VPN)
|
||||||
|
[#]: via: (https://opensource.com/article/21/5/open-source-private-vpn)
|
||||||
|
[#]: author: (Lukas Janėnas https://opensource.com/users/lukasjan)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (stevenzdg988)
|
||||||
|
[#]: reviewer: (wxy)
|
||||||
|
[#]: publisher: (wxy)
|
||||||
|
[#]: url: (https://linux.cn/article-13539-1.html)
|
||||||
|
|
||||||
|
使用开源工具创建私有的虚拟专用网络
|
||||||
|
======
|
||||||
|
|
||||||
|
> 使用 OpenWRT 和 Wireguard 在路由器上创建自己的虚拟专用网络。
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202107/01/101629ym69mwpmcmetdp99.jpg)
|
||||||
|
|
||||||
|
通过计算机网络从一个地方到另一个地方可能是一件棘手的事情。除了知道正确的地址和打开正确的端口之外,还有安全问题。 对于 Linux,SSH 是一种流行的默认方式,虽然你可以使用 SSH 做很多事情,但它仍然“只是”一个安全外壳(实际上,这就是 SSH 的含义)。用于加密流量的更广泛的协议是“虚拟专用网络”,它创建了一个独特的两点之间的虚拟的专用网络。有了它,你可以登录到另一个网络上的计算机并使用它的所有服务(文件共享、打印机等等),就像你坐在同一个房间里一样,并且全部的数据都是从点到点加密的。
|
||||||
|
|
||||||
|
通常,为了使虚拟专用网络连接成为可能,进入每个网络的网关必须接受虚拟专用网络流量,并且必须侦听目标网络上的某些计算机的虚拟专用网络流量。然而,你可以运行自己的带有虚拟专用网络服务器的路由器固件,使你能够连接到目标网络,而无需担心转发端口或考虑内部拓扑。我最喜欢的固件是 OpenWrt,在本文中我将演示如何设置它,以及如何启用虚拟专用网络。
|
||||||
|
|
||||||
|
### 什么是 OpenWrt?
|
||||||
|
|
||||||
|
[OpenWrt][2] 是一个使用 Linux 面向嵌入式设备的开源项目。它已经存在超过 15 年,拥有庞大而活跃的社区。
|
||||||
|
|
||||||
|
使用 OpenWrt 的方法有很多种,但它的主要用途是在路由器中。它提供了一个具有包管理功能的完全可写的文件系统,并且由于它是开源的,你可以查看和修改代码并为生态系统做出贡献。如果你想对路由器进行更多控制,这就是你想要使用的系统。
|
||||||
|
|
||||||
|
OpenWrt 支持很多路由器,包括 [思科][3]、[华硕][4]、[MikroTik][5]、[Teltonika Networks][6]、[D-Link][7]、[TP-link][8]、[Buffalo][9]、[Ubiquiti][10] 等知名品牌和 [许多其他品牌][11]。
|
||||||
|
|
||||||
|
### Wireguard 是什么?
|
||||||
|
|
||||||
|
[Wireguard][12] 是开源的虚拟专用网络软件,它比 OpenVPN 等其他选项更快、更简单且更安全。它使用最先进的密码学:用于对称加密的 ChaCha20;用于密钥协商的 Curve 25519(使用椭圆曲线),和用于散列的 BLAKE2。这些算法的设计方式在嵌入式系统上是高效的。Wireguard 也可用于各种操作系统 [平台][13]。
|
||||||
|
|
||||||
|
### 先决条件
|
||||||
|
|
||||||
|
对于这个项目,你需要:
|
||||||
|
|
||||||
|
* [Teltonika RUT955][14] 或支持 OpenWrt 的其他路由器
|
||||||
|
* 一个公网 IP 地址,用于从外部网络连接到虚拟专用网络
|
||||||
|
* 一部安卓手机
|
||||||
|
|
||||||
|
### 安装 OpenWrt
|
||||||
|
|
||||||
|
首先,下载路由器的 OpenWrt 镜像。使用 [固件选择器][15] 检查 OpenWrt 是否支持你的路由器并下载固件。输入你的路由器型号,将显示选项:
|
||||||
|
|
||||||
|
![OpenWRT 固件选择器][16]
|
||||||
|
|
||||||
|
使用搜索框右侧的下拉输入选择要下载的固件版本。
|
||||||
|
|
||||||
|
下载出厂镜像。
|
||||||
|
|
||||||
|
![下载出厂镜像][18]
|
||||||
|
|
||||||
|
许多路由器允许你从 Web 界面刷入未经授权的固件,但 Teltonika Networks 不允许。要将 OpenWrt 固件刷入这样的路由器,你需要使用引导加载器。为此,请按照下列步骤操作:
|
||||||
|
|
||||||
|
1. 拔掉路由器的电源线。
|
||||||
|
2. 按住重置按钮。
|
||||||
|
3. 插入路由器的电源线。
|
||||||
|
4. 插入电源线后,继续按住重置按钮 5 到 8 秒。
|
||||||
|
5. 将计算机的 IP 地址设置为 `192.168.1.15`,将网络掩码设置为 `255.255.255.0`。
|
||||||
|
6. 使用以太网电缆通过 LAN 端口连接路由器和计算机。
|
||||||
|
7. 打开网页浏览器并输入 `192.168.1.1:/index.html`。
|
||||||
|
8. 上传并刷写固件。
|
||||||
|
|
||||||
|
刷机过程可能占用三分钟。之后,你应该可以通过在浏览器中输入 `192.168.1.1` 来访问路由器的 Web 界面。 默认情况下没有设置密码
|
||||||
|
|
||||||
|
![OpenWrt 授权][19]
|
||||||
|
|
||||||
|
### 配置网络连接
|
||||||
|
|
||||||
|
网络连接是必要条件。如果你的 Internet 服务提供商(ISP) 使用 DHCP 自动分配你的 IP 地址,你只需将以太网电缆插入路由器的 WAN 端口。
|
||||||
|
|
||||||
|
如果你需要手动分配 IP 地址,导航至 “Network → Interfaces”。选择 “Edit” 编辑你的 WAN 接口。从 “Protocol” 字段中,选择 “Static address”,然后选择 “Switch protocol”。
|
||||||
|
|
||||||
|
![手动分配 IP 地址][20]
|
||||||
|
|
||||||
|
在 “IPv4 address” 字段中,输入你的路由器地址。设置 “IPv4 netmask” 以匹配你的网络子网;输入你将用于连接到网络的 “IPv4 gateway” 地址; 并在 “Use custom DNS servers” 字段中输入 DNS 服务器的地址。保存配置。
|
||||||
|
|
||||||
|
就是这样!你已成功配置 WAN 接口以获得网络连接。
|
||||||
|
|
||||||
|
### 安装必要的包
|
||||||
|
|
||||||
|
默认情况下,该固件不包含很多包,但 OpenWrt 有一个包管理器和可选安装的软件包。导航到 “System → Software” 并通过选择 “Update list...” 更新你的包管理器。
|
||||||
|
|
||||||
|
![OpenWrt 包管理器][21]
|
||||||
|
|
||||||
|
在“Filter”输入中,键入 “Wireguard”,等待系统找到所有包含该关键字的包。找到并安装名为 “luci-app-wireguard” 的包。
|
||||||
|
|
||||||
|
![luci-app-wireguard 包][22]
|
||||||
|
|
||||||
|
该软件包包括一个用于配置 Wireguard 的 Web 界面,并安装 Wireguard 所必需的所有依赖项。
|
||||||
|
|
||||||
|
如果你在安装 Wireguard 软件包之前收到一个软件包丢失的警告并且在存储库中找不到,请忽略它并继续。
|
||||||
|
|
||||||
|
接下来,找到并安装名为 “luci-app-ttyd” 的包。这将用于稍后访问终端。
|
||||||
|
|
||||||
|
安装这些软件包后,重新启动路由器以使更改生效。
|
||||||
|
|
||||||
|
### 配置 Wireguard 接口
|
||||||
|
|
||||||
|
接下来,创建 Wireguard 接口。导航到 “Network → Interfaces” 并选择左下角的 “Add new interface...”。在弹出窗口中,输入你想要的接口名称,从下拉列表中选择 “WireguardVPN”,然后选择右下角的 “Create interface”。
|
||||||
|
|
||||||
|
![创建 Wireguard 接口][23]
|
||||||
|
|
||||||
|
在新弹出的窗口中,选择 “Generate Key” 为 Wireguard 接口生成私钥。在 “Listen Port” 字段中,输入所需的端口。我将使用默认的 Wireguard 端口,“51820”。在 “IP Addresses” 字段中,分配将用于 Wireguard 接口的 IP 地址。在这个例子中,我使用了 `10.0.0.1/24`。数字 “24” 表明我的子网的大小。
|
||||||
|
|
||||||
|
![创建 Wireguard 接口][24]
|
||||||
|
|
||||||
|
保存配置并重启接口。
|
||||||
|
|
||||||
|
导航到 “Services → Terminal”,登录到 shell,然后输入命令 `wg show`。你将看到有关 Wiregaurd 接口的一些信息,包括其公钥。复制公钥——稍后你将需要它来创建对等点。
|
||||||
|
|
||||||
|
![Wireguard 公钥][25]
|
||||||
|
|
||||||
|
### 配置防火墙
|
||||||
|
|
||||||
|
导航到 “Network → Firewall” 并选择 “Traffic Rules” 选项卡。在页面底部,选择 “Add”。在弹出窗口的 “Name” 字段中,为你的规则命名,例如 “Allow-wg”。接下来,将 “Destination zone” 从 “Lan” 更改为 “Device”,并将 “Destination port” 设置为 “51820”。
|
||||||
|
|
||||||
|
![Wireguard 防火墙设置][26]
|
||||||
|
|
||||||
|
保存配置。
|
||||||
|
|
||||||
|
### 手机上配置 Wireguard
|
||||||
|
|
||||||
|
从 Google Play 在你的手机上安装 [Wireguard 应用程序][27]。安装后,打开应用程序并从头开始创建一个新接口。在 “Name” 字段中,输入要用于接口的名称。在 “Private key” 字段中,按右侧的双向箭头图标生成密钥对。你将需要上面的公钥来在你的手机和路由器之间创建一个对等点。在 “Addresses” 字段中,分配你将用于通过虚拟专用网络访问电话的 IP 地址。我将使用 `10.0.0.2/24`。在 “Listen port” 中,输入端口;我将再次使用默认端口。
|
||||||
|
|
||||||
|
![在 Android 上设置虚拟专用网络接口][28]
|
||||||
|
|
||||||
|
保存配置。
|
||||||
|
|
||||||
|
要向配置中添加对等点,请选择 “Add peer”。在 “Public key” 字段中,输入路由器的 Wireguard 公钥。在 “Endpoint” 字段中,输入路由器的公共 IP 地址和端口,以冒号分隔,例如 `12.34.56.78:51820`。在 “Allowed IP” 字段中,输入要通过 Wireguard 接口访问的 IP 地址。 (你可以输入路由器的虚拟专用网络接口 IP 地址和 LAN 接口地址。)IP 地址必须用逗号分隔。你还可以定义子网的大小。
|
||||||
|
|
||||||
|
![在 Android 上添加虚拟专用网络对等点][29]
|
||||||
|
|
||||||
|
保存配置。
|
||||||
|
|
||||||
|
配置中还剩下最后一步:在路由器上添加一个对等点。
|
||||||
|
|
||||||
|
### 在路由器上添加一个对等点
|
||||||
|
|
||||||
|
导航到 “Network → Interfaces” 并选择你的 Wireguard 接口。转到 “Peers” 选项卡并选择 “Add peer”。在 “Description” 字段中,输入对等方的名称。在 “Public Key” 字段中输入手机的 Wireguard 接口公钥,在 “Allowed IPs” 字段中输入手机的 Wireguard 接口 IP 地址。选中 “Route Allowed IPs” 复选框。
|
||||||
|
|
||||||
|
![在路由器上添加一个对等点][30]
|
||||||
|
|
||||||
|
保存配置并重启接口。
|
||||||
|
|
||||||
|
### 测试配置
|
||||||
|
|
||||||
|
在手机上打开 Web 浏览器。在 URL 栏中,输入 IP 地址 `10.0.0.1` 或 `192.168.1.1`。你应该能够访问路由器的网站。
|
||||||
|
|
||||||
|
![从 Android 登录 虚拟专用网络][31]
|
||||||
|
|
||||||
|
### 你自己的虚拟专用网络
|
||||||
|
|
||||||
|
这些天有很多虚拟专用网络服务商在做广告,但是拥有和控制自己的基础设施还有很多话要说,尤其是当该基础设施仅用于提高安全性时。无需依赖其他人为你提供安全的数据连接。使用 OpenWrt 和 Wireguard,你可以拥有自己的开源虚拟专用网络解决方案。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/5/open-source-private-vpn
|
||||||
|
|
||||||
|
作者:[Lukas Janėnas][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[stevenzdg988](https://github.com/stevenzdg988)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/lukasjan
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/vpn_scrabble_networking.jpg?itok=pdsUHw5N (scrabble letters used to spell "V")
|
||||||
|
[2]: https://openwrt.org/
|
||||||
|
[3]: https://www.cisco.com/c/en/us/products/routers/index.html
|
||||||
|
[4]: https://www.asus.com/Networking-IoT-Servers/WiFi-Routers/All-series/
|
||||||
|
[5]: https://mikrotik.com/
|
||||||
|
[6]: https://teltonika-networks.com/
|
||||||
|
[7]: https://www.dlink.com/en/consumer
|
||||||
|
[8]: https://www.tp-link.com/us/
|
||||||
|
[9]: https://www.buffalotech.com/products/category/wireless-networking
|
||||||
|
[10]: https://www.ui.com/
|
||||||
|
[11]: https://openwrt.org/toh/views/toh_fwdownload
|
||||||
|
[12]: https://www.wireguard.com/
|
||||||
|
[13]: https://www.wireguard.com/install/
|
||||||
|
[14]: https://teltonika-networks.com/product/rut955/
|
||||||
|
[15]: https://firmware-selector.openwrt.org/
|
||||||
|
[16]: https://opensource.com/sites/default/files/uploads/openwrt_firmware-selector.png (OpenWRT firmware selector)
|
||||||
|
[17]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[18]: https://opensource.com/sites/default/files/uploads/downloadfactoryimage.png (Downloading the Factory Image)
|
||||||
|
[19]: https://opensource.com/sites/default/files/uploads/openwrt_authorization.png (OpenWrt authorization)
|
||||||
|
[20]: https://opensource.com/sites/default/files/uploads/openwrt_staticaddress.png (Assigning IP address manually)
|
||||||
|
[21]: https://opensource.com/sites/default/files/uploads/openwrt_update-lists.png (OpenWrt package manager)
|
||||||
|
[22]: https://opensource.com/sites/default/files/uploads/wireguard-package.png (luci-app-wireguard package)
|
||||||
|
[23]: https://opensource.com/sites/default/files/uploads/wireguard_createinterface.png (Creating Wireguard interface)
|
||||||
|
[24]: https://opensource.com/sites/default/files/uploads/wireguard_createinterface2.png (Creating Wireguard interface)
|
||||||
|
[25]: https://opensource.com/sites/default/files/uploads/wireguard_publickey.png (Wireguard public key)
|
||||||
|
[26]: https://opensource.com/sites/default/files/uploads/wireguard-firewallsetup.png (Wireguard firewall setup)
|
||||||
|
[27]: https://play.google.com/store/apps/details?id=com.wireguard.android&hl=lt&gl=US
|
||||||
|
[28]: https://opensource.com/sites/default/files/uploads/vpn_inferfacesetup.png (Setting up V interface on Android)
|
||||||
|
[29]: https://opensource.com/sites/default/files/uploads/addpeeronphone.png (Adding a V peer on an Android)
|
||||||
|
[30]: https://opensource.com/sites/default/files/uploads/addpeeronrouter.png (Adding a peer on the router)
|
||||||
|
[31]: https://opensource.com/sites/default/files/uploads/android-vpn-login.png (Logging into the V from Android)
|
@ -3,28 +3,28 @@
|
|||||||
[#]: author: "Alan Smithee https://opensource.com/users/alansmithee"
|
[#]: author: "Alan Smithee https://opensource.com/users/alansmithee"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: "zepoch"
|
[#]: translator: "zepoch"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-13535-1.html"
|
||||||
|
|
||||||
为什么要为你的家庭自动化项目选择开源
|
为什么要为你的家庭自动化项目选择开源
|
||||||
======
|
======
|
||||||
|
|
||||||
家庭自动化是一个令人兴奋的技术分支。现在开始用开源工具为你的家庭自动化设计一套解决方案吧。
|
> 家庭自动化是一个令人兴奋的技术分支。现在开始用开源工具为你的家庭自动化设计一套解决方案吧。
|
||||||
|
|
||||||
![Working from home at a laptop][1]
|
![](https://img.linux.net.cn/data/attachment/album/202106/29/215353tk85i7m1myggvu8g.jpg)
|
||||||
|
|
||||||
行动起来吧。科技的关键是让生活更加美好。
|
行动起来吧。科技的关键是让生活更加美好。
|
||||||
|
|
||||||
当然,“更好”的标准因人而异,取决于他们在特定时刻的需求。尽管如此,技术具有影响许多不同阶段生活的独特能力。对一些人来说,科技提供了一个轻松的下午娱乐,而对另一些人来说,它提供导航帮助、改善医疗保健或更精确的科学研究。
|
当然,“更好”的标准因人而异,取决于他们在特定时刻的需求。尽管如此,技术具有影响许多不同阶段生活的独特能力。对一些人来说,科技提供了一个轻松的下午娱乐,而对另一些人来说,它提供导航帮助、改善医疗保健或更精确的科学研究。
|
||||||
|
|
||||||
有趣的是,为一个目的开发的技术很少与用于另一个目的的技术分开。例如,运动相机的进步使得一个人可以记录她们在滑雪场上的化雪过程,也可以使得人体摄像头来帮助防止警察侵犯人权。3D 打印的进步可以让一个人可以制作超级英雄的动作手办,也使得志愿者可以为体弱者制造氧气呼吸机成为可能。技术很重要,它影响着我们所有人。
|
有趣的是,为一个目的开发的技术很少与用于另一个目的的技术完全无关。例如,运动相机的进步使得一个人可以记录她们在滑雪场上的滑雪过程,也可以使得人体摄像头来帮助防止警察侵犯人权。3D 打印的进步可以让一个人可以制作超级英雄的动作手办,也使得志愿者可以为体弱者制造氧气呼吸机成为可能。技术很重要,它影响着我们所有人。
|
||||||
|
|
||||||
开源工作的一部分是确保每个人都能获得技术进步,无论种族、性别、国籍、身体能力、宗教信仰或财富如何。可悲的是,有些公司将技术视为一种工具来获取有关其客户(即您和我!)的数据,即使这些客户为该技术的研究和开发提供资金。不过,这不是开源的意义所在。 开源项目保护其用户。
|
开源的工作之一是确保每个人都能获得技术进步,无论种族、性别、国籍、身体能力、宗教信仰或财富如何。可悲的是,有些公司将技术视为一种工具来获取有关其客户(即你和我!)的数据,即使这些客户为该技术的研究和开发提供资金。不过,这不是开源的目标,开源项目保护其用户。
|
||||||
|
|
||||||
是的,家庭自动化是一种现代便利,它正在变得一天比一天好。但这是你的家。开源家庭自动化可以让生活变得更轻松,更像是所有科幻书籍和电影中承诺的未来。但它也可以改善那些身体能力与电器制造商计划不同的人的生活。 一个简单的 Python 脚本对一个用户来说可能只是带来了一些便利,而对其他人来说却可能会改变生活。
|
是的,家庭自动化是一种现代便利,它正在变得一天比一天好。但这是你的家。开源家庭自动化可以让生活变得更轻松,更像是所有科幻书籍和电影中承诺的未来。但它也可以改善那些身体能力与电器制造商计划不同的人的生活。一个简单的 Python 脚本对一个用户来说可能只是带来了一些便利,而对其他人来说却可能会改变生活。
|
||||||
|
|
||||||
家庭自动化是一个令人兴奋和有趣的技术分支。 借助这本**[电子书][2]**,立即开始设计您的家庭自动化解决方案,然后与他人分享您的创新,让每个人都能受益。
|
家庭自动化是一个令人兴奋和有趣的技术分支。 借助这本 **[电子书][2]**,立即开始设计你的家庭自动化解决方案,然后与他人分享你的创新,让每个人都能受益。
|
||||||
|
|
||||||
这就是开源的真正意义所在:可以帮助世界上的所有人。
|
这就是开源的真正意义所在:可以帮助世界上的所有人。
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ via: https://opensource.com/article/21/6/home-automation-ebook
|
|||||||
作者:[Alan Smithee][a]
|
作者:[Alan Smithee][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[zepoch](https://github.com/zepoch)
|
译者:[zepoch](https://github.com/zepoch)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -3,16 +3,16 @@
|
|||||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: (geekpi)
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: (wxy)
|
||||||
[#]: publisher: ( )
|
[#]: publisher: (wxy)
|
||||||
[#]: url: ( )
|
[#]: url: (https://linux.cn/article-13538-1.html)
|
||||||
|
|
||||||
如何在 Linux 上设置雷蛇设备的灯光效果和其他配置
|
如何在 Linux 上设置雷蛇设备的灯光效果和其他配置
|
||||||
======
|
======
|
||||||
|
|
||||||
你有一个闪亮的新雷蛇硬件,但你找不到 Linux 的 Razer Synapse 软件。而你最终没有正确的 RGB 同步,也没有办法定制它。你会怎么做呢?
|
你有了一个闪亮的新雷蛇硬件,但你找不到 Linux 的 Razer Synapse 软件。而你最终没有正确 RGB 同步,也没有办法定制它。你会怎么做呢?
|
||||||
|
|
||||||
好吧,对于某些功能,比如给你的鼠标添加宏,你仍然需要访问 Razer Synapse(在 Windows 或 MacOS上)。
|
好吧,对于某些功能,比如给你的鼠标添加宏,你仍然需要(在 Windows 或 MacOS 上)访问 Razer Synapse。
|
||||||
|
|
||||||
但是,要调整其他一些选项,如键盘的宏,改变鼠标的 DPI,或灯光效果,你可以在 Linux 上轻松设置你的雷蛇外设。
|
但是,要调整其他一些选项,如键盘的宏,改变鼠标的 DPI,或灯光效果,你可以在 Linux 上轻松设置你的雷蛇外设。
|
||||||
|
|
||||||
@ -36,11 +36,11 @@
|
|||||||
|
|
||||||
虽然这不是官方 Linux 驱动,但它在各种设备上工作良好。
|
虽然这不是官方 Linux 驱动,但它在各种设备上工作良好。
|
||||||
|
|
||||||
**它为各种 Linux 发行版提供支持,包括 Solus、openSUSE、Fedora、Debian、Arch Linux、Ubuntu 和其他一些发行版。**
|
它为各种 Linux 发行版提供支持,包括 Solus、openSUSE、Fedora、Debian、Arch Linux、Ubuntu 和其他一些发行版。
|
||||||
|
|
||||||
在这里,我将重点介绍在任何基于 Ubuntu 的发行版上安装它的步骤,对于其他发行版,你可能想参考[官方说明][8]。
|
在这里,我将重点介绍在任何基于 Ubuntu 的发行版上安装它的步骤,对于其他发行版,你可能想参考 [官方说明][8]。
|
||||||
|
|
||||||
你需要在 Ubuntu 上[使用 PPA][9] 安装 OpenRazer,下面是如何做的:
|
你需要在 Ubuntu 上 [使用 PPA][9] 安装 OpenRazer,下面是如何做的:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt install software-properties-gtk
|
sudo apt install software-properties-gtk
|
||||||
@ -49,7 +49,7 @@ sudo apt update
|
|||||||
sudo apt install openrazer-meta
|
sudo apt install openrazer-meta
|
||||||
```
|
```
|
||||||
|
|
||||||
它也提供了一个[守护进程][10],你可以选择让它工作,你要把你的用户加入到 **plugdev** 组,它给了设备的特权访问:
|
它也提供了一个 [守护进程][10],你可以选择让它工作,你要把你的用户加入到 `plugdev` 组,它给了设备的特权访问:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo gpasswd -a $USER plugdev
|
sudo gpasswd -a $USER plugdev
|
||||||
@ -57,7 +57,7 @@ sudo gpasswd -a $USER plugdev
|
|||||||
|
|
||||||
我不需要用上述命令中配置/添加一个守护程序,但我仍然可以很好地使用这些设备。守护进程主要是确保驱动保持活跃。
|
我不需要用上述命令中配置/添加一个守护程序,但我仍然可以很好地使用这些设备。守护进程主要是确保驱动保持活跃。
|
||||||
|
|
||||||
[下载 OpenRazer][11]
|
- [下载 OpenRazer][11]
|
||||||
|
|
||||||
### 步骤 2:安装一个 GUI 来管理和调整选项
|
### 步骤 2:安装一个 GUI 来管理和调整选项
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ sudo apt install polychromatic
|
|||||||
|
|
||||||
对于 Arch Linux 用户,你可以在 [AUR][14] 中找到它。关于更多的安装说明,你可以参考[官方下载页面][15]。
|
对于 Arch Linux 用户,你可以在 [AUR][14] 中找到它。关于更多的安装说明,你可以参考[官方下载页面][15]。
|
||||||
|
|
||||||
[下载 Polychromatic][16]
|
- [下载 Polychromatic][16]
|
||||||
|
|
||||||
你会得到不同设备的不同选项。在这里,我试着改变 DPI,自定义颜色周期,以及我的雷蛇 Basilisk v2 鼠标的轮询率,它完全正常。
|
你会得到不同设备的不同选项。在这里,我试着改变 DPI,自定义颜色周期,以及我的雷蛇 Basilisk v2 鼠标的轮询率,它完全正常。
|
||||||
|
|
||||||
![Customization options for a mouse][17]
|
![Customization options for a mouse][17]
|
||||||
|
|
||||||
如果你知道你想做什么,它还为你提供了轻松重启或停止[守护进程][10]、改变小程序图标和执行高级配置选项的能力。
|
如果你知道你想做什么,它还为你提供了轻松重启或停止 [守护进程][10]、改变小程序图标和执行高级配置选项的能力。
|
||||||
|
|
||||||
另外,你可以试试 [RazerGenie][18]、[Snake][19] 或 [OpenRGB][20] (用于改变颜色)来调整鼠标的颜色或任何其他设置。
|
另外,你可以试试 [RazerGenie][18]、[Snake][19] 或 [OpenRGB][20] (用于改变颜色)来调整鼠标的颜色或任何其他设置。
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ via: https://itsfoss.com/set-up-razer-devices-linux/
|
|||||||
作者:[Ankush Das][a]
|
作者:[Ankush Das][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[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/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -3,36 +3,36 @@
|
|||||||
[#]: author: (Miro Hrončok https://fedoramagazine.org/author/churchyard/)
|
[#]: author: (Miro Hrončok https://fedoramagazine.org/author/churchyard/)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: (geekpi)
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: (wxy)
|
||||||
[#]: publisher: ( )
|
[#]: publisher: (wxy)
|
||||||
[#]: url: ( )
|
[#]: url: (https://linux.cn/article-13536-1.html)
|
||||||
|
|
||||||
Fedora Linux 中的 Python 3.10 测试版
|
Fedora Linux 中的 Python 3.10 测试版
|
||||||
======
|
======
|
||||||
|
|
||||||
![][1]
|
![][1]
|
||||||
|
|
||||||
Python 开发者已经发布了 Python 3.10.0 的三个测试版本。今天,你可以在 Fedora Linux 中试用最新的版本 尽早用 3.10 测试你的 Python 代码,为 10 月份的 3.10.0 最终版本做好准备。
|
Python 开发者已经发布了 Python 3.10.0 的三个测试版本。现在,你可以在 Fedora Linux 中试用最新的版本尽早用 3.10 测试你的 Python 代码,为 10 月份的 3.10.0 最终版本做好准备。
|
||||||
|
|
||||||
### 在 Fedora Linux 上安装 Python 3.10
|
### 在 Fedora Linux 上安装 Python 3.10
|
||||||
|
|
||||||
如果你运行 Fedora Linux,你可以用 _dnf_ 从官方仓库安装 Python 3.10:
|
如果你运行 Fedora Linux,你可以用 `dnf` 从官方仓库安装 Python 3.10:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo dnf install python3.10
|
$ sudo dnf install python3.10
|
||||||
```
|
```
|
||||||
|
|
||||||
你可能需要启用 _updates-testing_ 仓库来获得最新的预发布版本:
|
你可能需要启用 `updates-testing` 仓库来获得最新的预发布版本:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo dnf install --enablerepo=updates-testing python3.10
|
$ sudo dnf install --enablerepo=updates-testing python3.10
|
||||||
```
|
```
|
||||||
|
|
||||||
随着更多的测试版和候选版[将被发布][2],Fedora 包将得到更新。不需要编译你自己的 Python 开发版本,只要安装它就可以获得最新。从第一个测试版开始,Python 开发者将不增加新的功能。你已经可以享受所有的新东西了。
|
随着更多的测试版和候选版 [发布][2],Fedora 包将得到更新。不需要编译你自己的 Python 开发版本,只要安装它就可以获得最新。从第一个测试版开始,Python 开发者不会再增加新的功能了。你已经可以享受所有的新东西了。
|
||||||
|
|
||||||
### 用 Python 3.10 测试你的项目
|
### 用 Python 3.10 测试你的项目
|
||||||
|
|
||||||
运行 _python3.10_ 命令来使用 Python 3.10,或者用[内置的 _venv_ 模块 tox][3] 或用 [pipenv][4] 和 [poetry][5] 创建虚拟环境。下面是一个使用 _tox_ 的例子:
|
运行 `python3.10` 命令来使用 Python 3.10,或者用 [内置的 venv 模块 tox][3] 或用 [pipenv][4] 和 [poetry][5] 创建虚拟环境。下面是一个使用 `tox` 的例子:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git clone https://github.com/benjaminp/six.git
|
$ git clone https://github.com/benjaminp/six.git
|
||||||
@ -56,11 +56,11 @@ ________________________ summary _________________________
|
|||||||
congratulations :)
|
congratulations :)
|
||||||
```
|
```
|
||||||
|
|
||||||
如果您在 Fedora Linux 上发现了 Python 3.10 的问题,请[在 Fedora 的 bugzilla 上提交 bug 报告][6]或在 [Python 的问题追踪][7]上提交。如果你不确定这是否是 Python 的问题,你可以[通过电子邮件或 IRC 直接联系 Fedora 的 Python 维护者][8] 。
|
如果你在 Fedora Linux 上发现了 Python 3.10 的问题,请 [在 Fedora 的 bugzilla 上提交 bug 报告][6] 或在 [Python 的问题追踪][7] 上提交。如果你不确定这是否是 Python 的问题,你可以 [通过电子邮件或 IRC 直接联系 Fedora 的 Python 维护者][8] 。
|
||||||
|
|
||||||
### Python 3.10 中的新内容
|
### Python 3.10 中的新内容
|
||||||
|
|
||||||
参见 [Python 3.10 的全部新闻列表][9]。例如,你可以尝试一下[结构模式匹配][10]:
|
参见 [Python 3.10 的全部新闻列表][9]。例如,你可以尝试一下 [结构模式匹配][10]:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ python3.10
|
$ python3.10
|
||||||
@ -87,7 +87,7 @@ X=3, Y=10
|
|||||||
10
|
10
|
||||||
```
|
```
|
||||||
|
|
||||||
请继续关注 [Fedora Linux 35 中将采用 Python 3.10 作为 _python3_][11]!
|
敬请期待 [Fedora Linux 35 中的 python3 —— Python 3.10][11]!
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ via: https://fedoramagazine.org/python-3-10-beta-in-fedora-linux/
|
|||||||
作者:[Miro Hrončok][a]
|
作者:[Miro Hrončok][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[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/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -3,37 +3,37 @@
|
|||||||
[#]: author: (Will Kelly https://opensource.com/users/willkelly)
|
[#]: author: (Will Kelly https://opensource.com/users/willkelly)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: (baddate)
|
[#]: translator: (baddate)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: (wxy)
|
||||||
[#]: publisher: ( )
|
[#]: publisher: (wxy)
|
||||||
[#]: url: ( )
|
[#]: url: (https://linux.cn/article-13541-1.html)
|
||||||
|
|
||||||
CI/CD 管道是什么?
|
CI/CD 管道是什么?
|
||||||
======
|
======
|
||||||
|
|
||||||
你如何定义持续集成/持续部署管道取决于你组织的要求。
|
> 你如何定义持续集成/持续部署管道取决于你组织的要求。
|
||||||
|
|
||||||
![Plumbing tubes in many directions][1]
|
![Plumbing tubes in many directions][1]
|
||||||
|
|
||||||
持续集成/持续部署 (CI/CD) 管道是每个 DevOps 计划的基础。 CI/CD 管道打破了传统的开发孤岛,使开发和运营团队能够在整个软件开发生命周期中进行协作。
|
<ruby>持续集成<rt>continuous integration</rt></ruby>/<ruby>持续部署<rt>continuous deployment</rt></ruby>(CI/CD)管道是每个 DevOps 计划的基础。 CI/CD 管道打破了传统的开发孤岛,使开发和运营团队能够在整个软件开发生命周期中进行协作。
|
||||||
|
|
||||||
更好的是,转向 DevOps 和 CI/CD 管道可以帮助你的组织以更高的速度更安全地[交付软件][2]。
|
更好的是,转向 DevOps 和 CI/CD 管道可以帮助你的组织以更高的速度更安全地 [交付软件][2]。
|
||||||
### Breaking down the CI/CD pipeline
|
|
||||||
|
### 拆解 CI/CD 管道
|
||||||
|
|
||||||
CI/CD 管道有很多定义,所以我总是建议组织定义自己的 CI/CD 管道版本和其他 DevOps 概念,而不是使用其他人的。开源 CI/CD 工具为你提供构建满足组织要求的 CI/CD 管道的自由和选择。
|
CI/CD 管道有很多定义,所以我总是建议组织定义自己的 CI/CD 管道版本和其他 DevOps 概念,而不是使用其他人的。开源 CI/CD 工具为你提供构建满足组织要求的 CI/CD 管道的自由和选择。
|
||||||
|
|
||||||
形成 CI/CD 管道的阶段是将不同的任务子集分组为 _管道阶段_。典型的管道阶段包括:
|
形成 CI/CD 管道的阶段是将不同的任务子集分组为 _管道阶段_。典型的管道阶段包括:
|
||||||
|
|
||||||
* **构建**:开发人员编译应用程序代码。
|
* **构建**:开发人员编译应用程序代码。
|
||||||
* **测试**:质量保证 (QA) 团队使用自动化测试工具和策略测试应用程序代码。
|
* **测试**:质量保证(QA)团队使用自动化测试工具和策略测试应用程序代码。
|
||||||
* **发布**:开发团队将应用程序代码交付到代码库。
|
* **发布**:开发团队将应用程序代码交付到代码库。
|
||||||
* **部署**:DevOps 团队将应用程序代码分阶段投入生产。
|
* **部署**:DevOps 团队将应用程序代码分阶段投入生产。
|
||||||
* **安全性和合规性**:QA 团队根据项目要求验证构建。这是组织部署容器扫描工具的阶段,这些工具根据常见漏洞和暴露 (CVE) 检查图像的质量。
|
* **安全性和合规性**:QA 团队根据项目要求验证构建。这是组织部署容器扫描工具的阶段,这些工具根据<ruby>常见漏洞和暴露<rt>Common Vulnerabilities and Exposures</rt></ruby>(CVE)检查容器镜像的质量。
|
||||||
|
|
||||||
|
这些是 CI/CD 管道的标准阶段,但一些组织调整 CI/CD 管道模型以满足他们的要求。例如,为医疗保健市场构建应用程序的组织,具有严格的合规性标准,可以在整个工具链中分发测试、验证和合规性门槛。
|
||||||
|
|
||||||
|
其他示例可能是依赖于具有开源软件(OSS)的复杂软件供应链的组织。商业组件可能会设立一个门槛,开发团队成员可以在其中为 OSS 包生成 <ruby>[软件物料清单][3]<rt>software bill of materials</rt></ruby>(SBOM),或者外部商业软件供应商必须将 SBOM 作为其合同可交付成果的一部分进行交付。
|
||||||
|
|
||||||
|
|
||||||
这些是 CI/CD 管道的标准阶段,但一些组织调整 CI/CD 管道模型以满足他们的要求。例如,为医疗保健市场构建应用程序的组织,具有严格的合规性标准,可以在整个工具链中分发测试、验证和合规性门。
|
|
||||||
|
|
||||||
其他示例可能是依赖于具有开源软件 (OSS) 的复杂软件供应链的组织。商业组件可能会设立一个门槛,开发团队成员可以在其中为 OSS 包生成[软件物料清单][3] (SBOM),或者外部商业软件供应商必须将 SBOM 作为其合同可交付成果的一部分进行交付。
|
|
||||||
### CI/CD 管道的障碍
|
### CI/CD 管道的障碍
|
||||||
|
|
||||||
实施 CI/CD 管道会改变团队的流程和文化。尽管许多开发人员愿意接受某些任务和测试的自动化,但人员可能成为采用 CI/CD 的障碍。
|
实施 CI/CD 管道会改变团队的流程和文化。尽管许多开发人员愿意接受某些任务和测试的自动化,但人员可能成为采用 CI/CD 的障碍。
|
||||||
@ -44,15 +44,15 @@ CI/CD 管道有很多定义,所以我总是建议组织定义自己的 CI/CD
|
|||||||
|
|
||||||
随着你在文化、流程和工具中达到更高的 DevOps 成熟度水平,包含 CI/CD 工具链的工具的开源根源为一些激动人心的集成创造了机会。
|
随着你在文化、流程和工具中达到更高的 DevOps 成熟度水平,包含 CI/CD 工具链的工具的开源根源为一些激动人心的集成创造了机会。
|
||||||
|
|
||||||
分析公司 Forrester 在 2020 年预测,即时学习将加入 CI/CD 管道。如果你考虑一下,会发现这是有道理的。在当前远程工作的时代,甚至对于新员工的远程入职,这更有意义。例如,组织可以将文档 wiki 与内部流程文档集成到其管道中。
|
分析公司 Forrester 在 2020 年预测,<ruby>即时学习<rt>just-in-time learning</rt></ruby>将加入 CI/CD 管道。如果你考虑一下,会发现这是有道理的。在当前远程工作的时代,甚至对于新员工的远程入职,这更有意义。例如,组织可以将文档 wiki 与内部流程文档集成到其管道中。
|
||||||
|
|
||||||
更雄心勃勃的组织可以将学习管理系统 (LMS)(例如 [Moodle][4])集成到其 CI/CD 管道中。它可以使用 LMS 发布有关新 DevOps 工具链功能的简短视频,开发人员在加入时或在整个管道中更新工具时需要学习这些功能。
|
更雄心勃勃的组织可以将学习管理系统(LMS)(例如 [Moodle][4])集成到其 CI/CD 管道中。它可以使用 LMS 发布有关新 DevOps 工具链功能的简短视频,开发人员在加入时或在整个管道中更新工具时需要学习这些功能。
|
||||||
|
|
||||||
一些组织正在将群聊和其他协作工具直接集成到他们的 CI/CD 管道中。聊天平台提供警报并支持团队之间的协作和沟通。将 Mattermost、Rocket.Chat 或其他[企业聊天][5]平台集成到你的 CI/CD 管道中需要预先规划和分析,以确保管道用户不会被警报淹没。
|
一些组织正在将群聊和其他协作工具直接集成到他们的 CI/CD 管道中。聊天平台提供警报并支持团队之间的协作和沟通。将 Mattermost、Rocket.Chat 或其他 [企业聊天][5] 平台集成到你的 CI/CD 管道中需要预先规划和分析,以确保管道用户不会被警报淹没。
|
||||||
|
|
||||||
另一个需要探索的集成机会是将分析和高级报告构建到你的 CI/CD 管道中。这有助于你利用通过管道传输的数据。
|
另一个需要探索的集成机会是将分析和高级报告构建到你的 CI/CD 管道中。这有助于你利用通过管道传输的数据。
|
||||||
|
|
||||||
### 最后的想法
|
### 总结
|
||||||
|
|
||||||
CI/CD 管道是 DevOps 的基础。开源使其能够适应并灵活地满足你在 DevOps 之旅中实施的运营变更所产生的新需求。
|
CI/CD 管道是 DevOps 的基础。开源使其能够适应并灵活地满足你在 DevOps 之旅中实施的运营变更所产生的新需求。
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ via: https://opensource.com/article/21/6/what-cicd-pipeline
|
|||||||
|
|
||||||
作者:[Will Kelly][a]
|
作者:[Will Kelly][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/baddate)
|
译者:[baddate](https://github.com/baddate)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,86 @@
|
|||||||
|
[#]: subject: (Dark and Light Only! Ubuntu 21.10 Looks to Ditch the Standard Mixed Color Theme)
|
||||||
|
[#]: via: (https://news.itsfoss.com/ubuntu-21-10-theme-change/)
|
||||||
|
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Dark and Light Only! Ubuntu 21.10 Looks to Ditch the Standard Mixed Color Theme
|
||||||
|
======
|
||||||
|
|
||||||
|
Ubuntu’s default “Yaru” community theme is an excellent choice. However, Ubuntu’s team has been tweaking it for a while since Ubutu 19.10 to match their branding and offer a good-looking experience.
|
||||||
|
|
||||||
|
I liked the default themes available with Ubuntu 20.04. Up until now, you got standard, light, and dark theme options to choose from.
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
But starting with [Ubuntu 21.10][2], you will no longer find the “**Standard**” (or mixed) theme available to pick. It all comes down to two choices that include light and dark theme only.
|
||||||
|
|
||||||
|
Now, why is this happening? What exactly is the Standard theme offering now?
|
||||||
|
|
||||||
|
Here’s what you need to know …
|
||||||
|
|
||||||
|
### Ubuntu’s Standard Theme is Problematic
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
If you have used Ubuntu, you probably know that Ubuntu’s Standard theme refers to a mixed theme. It features a dark window bar (or the titlebar of applications) and the rest follows a light theme pattern.
|
||||||
|
|
||||||
|
With **Ubuntu and GNOME’s default theme color conflicts** and **lack of theming API** for GTK (and Gnome shell), it is already [problematic][3] to customize and work on Ubuntu’s desktop theme.
|
||||||
|
|
||||||
|
Moreover, GTK 3 and GTK 4 do not support having a separate background color for the headerbar from the rest of the window. Hence, it is tough to keep bug-free implementations for every GTK application.
|
||||||
|
|
||||||
|
And that is the reason the Yaru community design team recently [proposed][4] to remove the mixed theme.
|
||||||
|
|
||||||
|
Ubuntu’s team has agreed to this decision and the change has been merged. You should no longer find the mixed theme in Ubuntu 21.10 but only the dark and light themes as your option.
|
||||||
|
|
||||||
|
In other words, “Yaru” will be the light theme, and “Yaru dark” will be the dark theme when using [GNOME Tweaks][5]. There will be no “Yaru-light” anymore.
|
||||||
|
|
||||||
|
### Will They Bring Back the Mixed Theme?
|
||||||
|
|
||||||
|
Unless there are changes in the upstream — GNOME providing a theming API and GTK 3/4 supporting more customizability for headerbar, the mixed theme is gone for good.
|
||||||
|
|
||||||
|
So, with Ubuntu 21.10 and any future releases, you get fully light and fully dark themes, which should offer a seamless user experience across any GTK application.
|
||||||
|
|
||||||
|
### A Potential Rebranding in Ubuntu 21.10
|
||||||
|
|
||||||
|
While the Brand and Visual team at Canonical agreed to the default Yaru theme changes, they also want to work closely with the Yaru community design team for the upcoming rebranding, as mentioned by a designer in this [GitHub thread][4]:
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
So, what exactly do we know about the upcoming rebranding for Ubuntu 21.10? Nothing yet.
|
||||||
|
|
||||||
|
But considering that Ubuntu 20.04 shaped up with attractive branding and visuals, I’m excited about this one. Most probably, the default color scheme will change – but what what will it change to?
|
||||||
|
|
||||||
|
Let’s wait for that! Feel free to share your thoughts on this development on Ubuntu’s future design in the comments below.
|
||||||
|
|
||||||
|
First noticed at: [OMG! Ubuntu][7]
|
||||||
|
|
||||||
|
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||||
|
|
||||||
|
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||||
|
|
||||||
|
I'm not interested
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.itsfoss.com/ubuntu-21-10-theme-change/
|
||||||
|
|
||||||
|
作者:[Ankush Das][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUzNSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[2]: https://news.itsfoss.com/ubuntu-21-10-release-schedule/
|
||||||
|
[3]: https://github.com/ubuntu/yaru/discussions/2677
|
||||||
|
[4]: https://github.com/ubuntu/yaru/issues/2913
|
||||||
|
[5]: https://itsfoss.com/gnome-tweak-tool/
|
||||||
|
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE1OCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[7]: https://www.omgubuntu.co.uk/2021/06/ubuntu-21-10-yarn-theme-change
|
@ -0,0 +1,88 @@
|
|||||||
|
[#]: subject: (Nextcloud Alternative Twake Adds New Features and Privacy Improvements)
|
||||||
|
[#]: via: (https://news.itsfoss.com/twake-2021-q2-release/)
|
||||||
|
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Nextcloud Alternative Twake Adds New Features and Privacy Improvements
|
||||||
|
======
|
||||||
|
|
||||||
|
If you did not know about Twake, you might want to check out our quick review on [Twake app][1] on our main portal.
|
||||||
|
|
||||||
|
To give you a quick introduction, I would say that Twake aims to be a modern, open-source Nextcloud alternative with Slack-like features in the mix. In other words, it could be an all-in-one solution for your requirements.
|
||||||
|
|
||||||
|
Now, after several updates to the platform, there’s a big release that addresses some improvements and adds a couple of new features.
|
||||||
|
|
||||||
|
Here, let me give you some highlights of the latest release.
|
||||||
|
|
||||||
|
### New and Improved Channels
|
||||||
|
|
||||||
|
If you are using Twake to collaborate and communicate as an [open-source alternative to Slack][2], there are some significant improvements to the way everyone interacts with channels.
|
||||||
|
|
||||||
|
It is now super easy to leave and join channels, which needed attention in its early implementation.
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
The channel access rights have been tweaked to let the team members create a channel as per their requirements. If you have a lot of channels and want to add some of them for quick access, you can now add them to favorites to do just that.
|
||||||
|
|
||||||
|
Also, if you are in dire need of multiple channels, you will have to ability to create groups of channels to better organize them.
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
If you create a public channel, you can invite all your workspace members to it in one go. Also, if a new user joins, they will be added to all the public channels by default.
|
||||||
|
|
||||||
|
### Colleagues and Guest Management
|
||||||
|
|
||||||
|
![][5]
|
||||||
|
|
||||||
|
You get a new add colleague button to add collaborators using their email addresses. While it makes things convenient, it is also great to see that you can invite anyone not in your workplace as a guest to a direct channel when needed.
|
||||||
|
|
||||||
|
### Privacy and Other Improvements
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
Originally, they used Amazon Web Services (AWS) to host everything. Now, they have switched to a France-based server (OVH Cloud) as someone with a better privacy policy in place.
|
||||||
|
|
||||||
|
Under-the-hood, they have also transitioned from using PHP to NodeJS in the back end to make things faster.
|
||||||
|
|
||||||
|
They have made several technical improvements to ensure security of users’ data and also improved the notifications.
|
||||||
|
|
||||||
|
To learn more about what’s coming next and about this specific release, you can check out their [official announcement][7] or the [GitHub page][8].
|
||||||
|
|
||||||
|
[Twake.app][9]
|
||||||
|
|
||||||
|
If you haven’t tried Twake yet, it is an interesting choice to go for. While there are some room for improvements like the addition of two-factor authentication for free and standard users, it is an impressive experience.
|
||||||
|
|
||||||
|
_What do you think about Twake? Feel free to share your thoughts in the comments down below._
|
||||||
|
|
||||||
|
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||||
|
|
||||||
|
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||||
|
|
||||||
|
I'm not interested
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.itsfoss.com/twake-2021-q2-release/
|
||||||
|
|
||||||
|
作者:[Ankush Das][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/twake-app/
|
||||||
|
[2]: https://itsfoss.com/open-source-slack-alternative/
|
||||||
|
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQxNCIgd2lkdGg9IjU1MyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUzMiIgd2lkdGg9Ijc1MSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ5OCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQzOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[7]: https://www.linagora.com/en/post/2021/06/22/twake-q2-505-product-update-en
|
||||||
|
[8]: https://github.com/linagora/Twake
|
||||||
|
[9]: https://twake.app/en/
|
@ -0,0 +1,86 @@
|
|||||||
|
[#]: subject: (Children’s Drawing App Tux Paint Now Has Gradient Fill and Pixel Art Options)
|
||||||
|
[#]: via: (https://news.itsfoss.com/tux-paint-0-9-26/)
|
||||||
|
[#]: author: (Abhishek https://news.itsfoss.com/author/root/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Children’s Drawing App Tux Paint Now Has Gradient Fill and Pixel Art Options
|
||||||
|
======
|
||||||
|
|
||||||
|
Tux Paint is an [open source drawing application][1] and an alternative to Microsoft Paint on Linux. It is a cross-platform application and you can also use it on Windows and macOS.
|
||||||
|
|
||||||
|
[Tux Paint][2] primarily intends to be used by children between the age of 3 and 12. It is actually used in schools worldwide. It features easy to use interface, sound effect and a Tux mascot that works as guide in an entertaining way.
|
||||||
|
|
||||||
|
Of course, this doesn’t mean that you cannot use Tux Paint if you are 13 or older.
|
||||||
|
|
||||||
|
The developers of Tux Paint have just released the version 0.9.26. Let’s see what new features you get in the latest release.
|
||||||
|
|
||||||
|
### What’s new in Tux Paint 0.9.26?
|
||||||
|
|
||||||
|
Here are the main new features in improvement added in the version 0.9.26.
|
||||||
|
|
||||||
|
#### Fill tool now has gradient option
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
Gradient colors have gained quite some popularity lately. Keeping that in mind, Tux Paint’s Fill tool now can fill the selected area with gradient colors.
|
||||||
|
|
||||||
|
There are two kinds of gradients filling available. The “Radial” fill creates a circular gradient centered around the mouse click, while the “Linear” fill allows the interactive creation of gradients at different angles and sizes.
|
||||||
|
|
||||||
|
#### Magic tools now has pixel and checkerboard options
|
||||||
|
|
||||||
|
The Magic tool now has “pixel” options that makes it easier to create retro-gaming style pixel art. It doesn’t give the capability of full-fledged pixel tool like [Pixelorama][4] but at pixelating is available as an option.
|
||||||
|
|
||||||
|
There is also a Checkerboard option that fills the entire canvas with a check pattern and the “Clone” option allows duplicating parts of the picture via brush strokes.
|
||||||
|
|
||||||
|
#### Accessibility improvements
|
||||||
|
|
||||||
|
![][5]
|
||||||
|
|
||||||
|
The new version has two accessibility options added. The entire user interface of Tux Paint can now be enlarged. This is going to benefit users with impaired vision. This will also make the program more suitable to very HiDPI displays.
|
||||||
|
|
||||||
|
Another option is to re-organize the color palette. It can also be helpful to users of coarse input devices, such as eye-gaze tracking systems.
|
||||||
|
|
||||||
|
#### What else?
|
||||||
|
|
||||||
|
Tux Paint’s user documentation has been overhauled and this makes localization easier. So if you are interested, please contact the Tux Paint team and help with localization efforts.
|
||||||
|
|
||||||
|
#### Getting Tux Paint 0.9.26
|
||||||
|
|
||||||
|
On Linux, you can get the latest Tux Paint in [Flatpak package format][6]. If you have Flatpak support enabled, you can use the following command to install it:
|
||||||
|
|
||||||
|
```
|
||||||
|
flatpak install flathub org.tuxpaint.Tuxpaint
|
||||||
|
```
|
||||||
|
|
||||||
|
For Windows and macOS, you can [download it from its website][7].
|
||||||
|
|
||||||
|
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||||
|
|
||||||
|
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||||
|
|
||||||
|
I'm not interested
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.itsfoss.com/tux-paint-0-9-26/
|
||||||
|
|
||||||
|
作者:[Abhishek][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/root/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/open-source-paint-apps/
|
||||||
|
[2]: http://www.tuxpaint.org/
|
||||||
|
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjU4NSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[4]: https://itsfoss.com/pixelorama/
|
||||||
|
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjYyNCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[6]: https://flathub.org/apps/details/org.tuxpaint.Tuxpaint
|
||||||
|
[7]: http://www.tuxpaint.org/download/
|
@ -0,0 +1,90 @@
|
|||||||
|
[#]: subject: (KaOS 2021.06 Brings in Plasma 5.22, JPEG XL Support, and More)
|
||||||
|
[#]: via: (https://news.itsfoss.com/kaos-2021-06-release/)
|
||||||
|
[#]: author: (Omar Maarof https://news.itsfoss.com/author/omar/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
KaOS 2021.06 Brings in Plasma 5.22, JPEG XL Support, and More
|
||||||
|
======
|
||||||
|
|
||||||
|
[KaOS][1] is an independent Linux/GNU distribution built from scratch. It is uses Qt and [KDE][2], comes baked in with [pacman][3] as its package manager.
|
||||||
|
|
||||||
|
The latest version comes with useful upgrades. Let’s discover what this version has to offer.
|
||||||
|
|
||||||
|
### What’s New?
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
KaOS 2021.06 comes with [Plasma 5.22][5], which is the latest and the most stable release currently. Not just limited to stability, it also provides better flexibility and usability. To know more about the desktop environment, you can refer to our article on [Plasma 5.22][6].
|
||||||
|
|
||||||
|
To give you a quick overview, the most remarkable new feature Plasma 5.22 presents is **Adaptive Transparency. **It means the panel and panel widgets will be pleasantly translucent. However, if there are any maximized windows, they will become entirely opaque.
|
||||||
|
|
||||||
|
Also, **Plasma Wayland** session now supports **Activities. **Thus, you can keep your work separate from other tasks. In other words, you will get the most out of your activity by staying focused on it.
|
||||||
|
|
||||||
|
Along with the desktop environment upgrade, some of the key changes include:
|
||||||
|
|
||||||
|
* Plasma System Monitor now replaces KSysguard.
|
||||||
|
* No need to adjust a mirror list to install/update KaOS anymore. KaOS will be using Fosshost as the default mirror, which utilizes Fastly CDN to deliver the content from a nearby location without you needing to select a mirror explicitly.
|
||||||
|
* KWin Wayland now includes the Present Windows effect.
|
||||||
|
* New applications added include [Maliit][7] virtual keyboard packages.
|
||||||
|
* Support for [JPEG XL][8], a modern option for the JPEG format.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
![][9]
|
||||||
|
|
||||||
|
### Other Improvements
|
||||||
|
|
||||||
|
* The Calamares installer has two new QML modules to provide consistent layout and the interactive map that you notice in the installer should work fine without an active internet connection.
|
||||||
|
* All of the latest Plasma Desktop packages are built on **Qt 5.15.2+**. These include Frameworks 5.83.0, Plasma 5.22.2, and KDE applications 21.04.2.
|
||||||
|
* LibreOffice has replaced Calligra as the default office suite.
|
||||||
|
* Installing on RAID is currently unavailable.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
![][10]
|
||||||
|
|
||||||
|
For more details you can refer to the [official announcement][11].
|
||||||
|
|
||||||
|
### Summing Up
|
||||||
|
|
||||||
|
KaOS is making progress towards providing a complete and focused open-source operating system. They are working on presenting constant enhancements within the scope of KDE.
|
||||||
|
|
||||||
|
[Download KaOS 2021.06][12]
|
||||||
|
|
||||||
|
_What do you think about KaOS with Plasma 5.22? Would you be willing to try it out?_
|
||||||
|
|
||||||
|
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||||
|
|
||||||
|
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||||
|
|
||||||
|
I'm not interested
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.itsfoss.com/kaos-2021-06-release/
|
||||||
|
|
||||||
|
作者:[Omar Maarof][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/omar/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://kaosx.us/
|
||||||
|
[2]: https://kde.org/
|
||||||
|
[3]: https://itsfoss.com/pacman-command/
|
||||||
|
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQzOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[5]: https://kde.org/announcements/plasma/5/5.22.0/
|
||||||
|
[6]: https://news.itsfoss.com/kde-plasma-5-22-release/
|
||||||
|
[7]: https://maliit.github.io/
|
||||||
|
[8]: https://jpeg.org/jpegxl/
|
||||||
|
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjU3NSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[10]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ4OCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[11]: https://kaosx.us/news/2021/kaos06/
|
||||||
|
[12]: https://kaosx.us/pages/download/
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: (https://opensource.com/article/21/5/weird-jobs-tech)
|
[#]: via: (https://opensource.com/article/21/5/weird-jobs-tech)
|
||||||
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (MM-BCY)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
@ -36,7 +36,7 @@ via: https://opensource.com/article/21/5/weird-jobs-tech
|
|||||||
|
|
||||||
作者:[Chris Hermansen][a]
|
作者:[Chris Hermansen][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[MM-BCY](https://github.com/译者ID)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: (https://fedoramagazine.org/jim-hall-how-do-you-fedora/)
|
[#]: via: (https://fedoramagazine.org/jim-hall-how-do-you-fedora/)
|
||||||
[#]: author: (Karimi Hari Priya https://fedoramagazine.org/author/haripriya21/)
|
[#]: author: (Karimi Hari Priya https://fedoramagazine.org/author/haripriya21/)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (zz-air)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
@ -60,7 +60,7 @@ via: https://fedoramagazine.org/jim-hall-how-do-you-fedora/
|
|||||||
|
|
||||||
作者:[Karimi Hari Priya][a]
|
作者:[Karimi Hari Priya][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[zz-air](https://github.com/zz-air)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
110
sources/talk/20210629 A brief history of FreeDOS.md
Normal file
110
sources/talk/20210629 A brief history of FreeDOS.md
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
[#]: subject: (A brief history of FreeDOS)
|
||||||
|
[#]: via: (https://opensource.com/article/21/6/history-freedos)
|
||||||
|
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
A brief history of FreeDOS
|
||||||
|
======
|
||||||
|
Throughout its nearly 30-year journey, FreeDOS has been the modern DOS.
|
||||||
|
![Person typing on a 1980's computer][1]
|
||||||
|
|
||||||
|
A master was explaining the nature of [The Tao of Programming][2] to one of his novices. "The Tao is embodied in all software—regardless of how insignificant," said the master.
|
||||||
|
|
||||||
|
"Is Tao in a hand-held calculator?" asked the novice.
|
||||||
|
|
||||||
|
"It is," came the reply.
|
||||||
|
|
||||||
|
"Is the Tao in a video game?" continued the novice.
|
||||||
|
|
||||||
|
"It is even in a video game," said the master.
|
||||||
|
|
||||||
|
"And is the Tao in the DOS for a personal computer?"
|
||||||
|
|
||||||
|
The master coughed and shifted his position slightly. "The lesson is over for today," he said.
|
||||||
|
|
||||||
|
The Tao of Programming, Geoffrey James, InfoBooks, 1987
|
||||||
|
|
||||||
|
Computing used to be limited only to expensive mainframes and "Big Iron" computer systems like the PDP11. But the advent of the microprocessor brought about a computing revolution in the 1970s. You could finally have a computer in your home—the "personal computer" had arrived!
|
||||||
|
|
||||||
|
The earliest personal computers I remember seeing included the Commodore, TRS-80, and Apple. The personal computer became such a hot topic that IBM decided to enter the market. After a rapid development cycle, IBM released the IBM 5150 Personal Computer (the original "IBM PC") in August 1981.
|
||||||
|
|
||||||
|
Creating a computer from scratch is no easy task, so IBM famously used "off-the-shelf" hardware to build the PC, and licensed other components from outside developers. One of those was the operating system, licensed from Microsoft. In turn, Microsoft acquired 86-DOS from Seattle Computer Products, applied various updates, and debuted the new version with the IBM PC as IBM PC-DOS.
|
||||||
|
|
||||||
|
### Early DOS
|
||||||
|
|
||||||
|
Running in memory _up to_ 640 kilobytes, DOS really couldn't do much more than manage the hardware and allow the user to launch applications. As a result, the PC-DOS 1.0 command line was pretty anemic, only including a few commands to set the date and time, manage files, control the terminal, and format floppy disks. DOS also included a BASIC language interpreter, which was a standard feature in all personal computers of the era.
|
||||||
|
|
||||||
|
It wasn't until PC-DOS 2.0 that DOS became more interesting, adding new commands to the command line, and including other useful tools. But for me, it wasn't until MS-DOS 5.0 in 1991 that DOS began to feel "modern." Microsoft overhauled DOS in this release, updating many of the commands and replacing the venerable Edlin editor with a new full-screen editor that was more user-friendly. DOS 5 included other features that I liked, as well, such as a new BASIC interpreter based on Microsoft QuickBASIC Compiler, simply called QBASIC. If you've ever played the Gorillas game on DOS, it was probably in MS-DOS 5.0.
|
||||||
|
|
||||||
|
Despite these upgrades, I wasn't entirely satisfied with the DOS command line. DOS never strayed far from the original design, which proved limiting. DOS gave the user a few tools to do some things from the command line—otherwise, you were meant to use the DOS command line to launch applications. Microsoft assumed the user would spend most of their time in a few key applications, such as a word processor or spreadsheet.
|
||||||
|
|
||||||
|
But developers wanted a more functional DOS, and a sub-industry sprouted to offer neat tools and programs. Some were full-screen applications, but many were command-line utilities that enhanced the DOS command environment. When I learned a bit of C programming, I started writing my own utilities that extended or replaced the DOS command line. And despite the rather limited underpinnings of MS-DOS, I found that the third-party utilities, plus my own, created a powerful DOS command line.
|
||||||
|
|
||||||
|
### FreeDOS
|
||||||
|
|
||||||
|
In early 1994, I started seeing a lot of interviews with Microsoft executives in tech magazines saying the next version of Windows would totally do away with DOS. I'd used Windows before—but if you remember the era, you know Windows 3.1 wasn't a great platform. Windows 3.1 was clunky and buggy—if an application crashed, it might take down the entire Windows system. And I didn't like the Windows graphical user interface, either. I preferred doing my work at the command line, not with a mouse.
|
||||||
|
|
||||||
|
I considered Windows and decided, “If Windows 3.2 or Windows 4.0 will be anything like Windows 3.1, I want nothing to do with it.” But what were my options? I'd already experimented with Linux at this point, and thought [Linux was great][3]—but Linux didn't have any applications. My word processor, spreadsheet, and other programs were on DOS. I needed DOS.
|
||||||
|
|
||||||
|
Then I had an idea! I thought, “If developers can come together over the internet to write a complete Unix operating system, surely we can do the same thing with DOS.” After all, DOS was a fairly straightforward operating system compared to Unix. DOS ran one task at a time (single-tasking) and had a simpler memory model. It shouldn't be _that_ hard to write our own DOS.
|
||||||
|
|
||||||
|
So on June 29, 1994, I [posted an announcement][4] to `comp.os.msdos.apps`, on a message board network called Usenet:
|
||||||
|
|
||||||
|
ANNOUNCEMENT OF PD-DOS PROJECT:
|
||||||
|
|
||||||
|
A few months ago, I posted articles relating to starting a public domain version of DOS. The general support for this at the time was strong, and many people agreed with the statement, "start writing!" So, I have...
|
||||||
|
|
||||||
|
Announcing the first effort to produce a PD-DOS. I have written up a "manifest" describing the goals of such a project and an outline of the work, as well as a "task list" that shows exactly what needs to be written. I'll post those here, and let discussion follow.
|
||||||
|
|
||||||
|
_* A note about the name—I wanted this new DOS to be something that everyone could use, and I naively assumed that when everyone could use it, it was "public domain." I quickly realized the difference, and we renamed "PD-DOS" to "Free-DOS"—and later dropped the hyphen to become "FreeDOS."_
|
||||||
|
|
||||||
|
A few developers reached out to me, to offer utilities they had created to replace or enhance the DOS command line, similar to my own efforts. We pooled our utilities and created a useful system that we released as "Alpha 1" in September 1994, just a few months after announcing the project. Development was pretty swift in those days, and we followed up with "Alpha 2" in December 1994, "Alpha 3" in January 1995, and "Alpha 4" in June 1995.
|
||||||
|
|
||||||
|
### A modern DOS
|
||||||
|
|
||||||
|
Since then, we've always focused on making FreeDOS a "modern" DOS. And much of that modernization is centered on creating a rich command-line environment. Yes, DOS still needs to support applications, but we believe FreeDOS needs a strong command-line environment, as well. That's why FreeDOS includes dozens of useful tools, including commands to navigate directories, manage files, play music, connect to networks, ... and a collection of Unix-like utilities such as `less`, `du`, `head`, `tail`, `sed`, and `tr`.
|
||||||
|
|
||||||
|
While FreeDOS development has slowed, it has not stopped. Developers continue to write new programs for FreeDOS, and add new features to FreeDOS. I'm particularly excited about several great additions to FreeDOS 1.3 RC4, the latest release candidate for the forthcoming FreeDOS 1.3. A few recent updates:
|
||||||
|
|
||||||
|
* Mateusz Viste created a new ebook reader called Ancient Machine Book (AMB) that we've leveraged as the new help system in FreeDOS 1.3 RC4
|
||||||
|
* Rask Ingemann Lambertsen, Andrew Jenner, TK Chia, and others are updating the IA-16 version of GCC, including a new _libi86_ library that provides some degree of compatibility with the Borland Turbo C++ compiler's C library
|
||||||
|
* Jason Hood has updated an unloadable CD-ROM redirector substitute for Microsoft's MSCDEX, supporting up to 10 drives
|
||||||
|
* SuperIlu has created DOjS, a Javascript development canvas with an integrated editor, graphics and sound output, and mouse, keyboard, and joystick input
|
||||||
|
* Japheth has created a DOS32PAE extender that is able to use huge amounts of memory through PAE paging
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Despite all of the new development on FreeDOS, we remain true to our DOS roots. As we continue working toward FreeDOS 1.3 "final," we carry several core assumptions, including:
|
||||||
|
|
||||||
|
* **Compatibility is key**—FreeDOS isn't really "DOS" if it can't run classic DOS applications. While we provide many great open source tools, applications, and games, you can run your legacy DOS applications, too.
|
||||||
|
* **Continue to run on old PCs (XT, '286, '386, etc)**—FreeDOS 1.3 will remain 16-bit Intel but will support new hardware with expanded driver support, where possible. For this reason, we continue to focus on a single-user command-line environment.
|
||||||
|
* **FreeDOS is open source software**—I've always said that FreeDOS isn't a "free DOS" if people can't access, study, and modify the source code. FreeDOS 1.3 will include software that uses recognized open source licenses as much as possible. But DOS actually pre-dates the GNU General Public License (1989) and the Open Source Definition (1998) so some DOS software might use its own "free with source code" license that isn't a standard "open source" license. As we consider packages to include in FreeDOS, we continue to evaluate any licenses to ensure they are suitably "open source," even if they are not officially recognized.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
We welcome your help in making FreeDOS great! Please join us on our email list—we welcome all newcomers and contributors. We communicate over an email list, but the list is fairly low volume so is unlikely to fill up your Inbox.
|
||||||
|
|
||||||
|
Visit the FreeDOS website at [www.freedos.org][5].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/6/history-freedos
|
||||||
|
|
||||||
|
作者:[Jim Hall][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/jim-hall
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
|
||||||
|
[2]: https://www.mit.edu/~xela/tao.html
|
||||||
|
[3]: https://opensource.com/article/17/5/how-i-got-started-linux-jim-hall-freedos
|
||||||
|
[4]: https://groups.google.com/g/comp.os.msdos.apps/c/oQmT4ETcSzU/m/O1HR8PE2u-EJ
|
||||||
|
[5]: https://www.freedos.org/
|
@ -0,0 +1,150 @@
|
|||||||
|
[#]: subject: (How a college student founded a free and open source operating system)
|
||||||
|
[#]: via: (https://opensource.com/article/21/6/freedos-founder)
|
||||||
|
[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
How a college student founded a free and open source operating system
|
||||||
|
======
|
||||||
|
An interview with FreeDOS founder Jim Hall.
|
||||||
|
![Puzzle pieces coming together to form a computer screen][1]
|
||||||
|
|
||||||
|
[Jim Hall][2] is best known as the computer programmer who founded the FreeDOS project. Jim began the project in 1994 as a replacement for MS-DOS while he was still a student at the University of Wisconsin–River Falls. Jim created FreeDOS in response to Microsoft ending support for MS-DOS in 1994. Recently Jim agreed to an email interview. Correspondent Joshua Allen Holm joined me in posing the following questions to Jim.
|
||||||
|
|
||||||
|
**Don Watkins: What kind of skill set invites you to write your own operating system?**
|
||||||
|
|
||||||
|
I think even a beginner can get started writing an operating system like FreeDOS, although it would take a more advanced programmer to write the kernel.
|
||||||
|
|
||||||
|
[I am a self-taught programmer][3]. I learned about programming from an early age by tinkering on our Apple II computer at home. Much later, I learned C programming—my brother was a computer science student when I was a physics student, and he introduced me to C. I picked up the rest by reading books and writing my own programs.
|
||||||
|
|
||||||
|
I wrote a lot of small utilities that enhanced my command line on MS-DOS or even replaced certain DOS commands. And you can write a lot of those programs even with a basic level of programming experience. You can write file utilities like FIND, FC, CHOICE, TYPE, MORE, or COPY—or user commands like ECHO or CLS—with only an introduction to C programming. With a bit of practice, you can write system-level programs like ATTRIB, or the COMMAND shell.
|
||||||
|
|
||||||
|
**DW: Were you inspired by Linus Torvalds when you decided to write your own version of DOS and how did that contribute to your licensing decision?**
|
||||||
|
|
||||||
|
In a way, yes. I really liked DOS and had been using it since the early 1980s. I ran MS-DOS on my personal computer at university. But in 1993, I discovered Linux.
|
||||||
|
|
||||||
|
I really liked the Unix systems in our campus computer lab, where I spent much of my time as an undergraduate university student. When I heard about Linux, a free version of Unix that I could run on my ’386 computer at home, I immediately wanted to try it out. [My first Linux distribution][4] was Softlanding Linux System (SLS) 1.03, with Linux kernel 0.99 alpha patch level 11. That required a whopping 2MB of RAM, or 4MB if you wanted to compile programs, and 8MB to run X windows.
|
||||||
|
|
||||||
|
I dual-booted Linux with MS-DOS. I booted into Linux most of the time, but I still booted back into MS-DOS to write papers in a word processor, to use a spreadsheet program to analyze data for my lab classes or to play my favorite DOS games.
|
||||||
|
|
||||||
|
In 1994, I heard that Microsoft planned to “do away” with MS-DOS. The next version of Windows would eliminate DOS. I didn’t like that, and I still wanted to run DOS. I decided that if folks could come together over the Internet to write something like Linux, surely, we could do the same with DOS. After all, DOS was fairly simple compared to Linux.
|
||||||
|
|
||||||
|
On June 29, 1994, [I announced the “PD-DOS” project][5] to write our own DOS. I called it “PD” because I thought it would be in the public domain. But I quickly learned about the GNU General Public License that the Linux kernel used, and decided that was a much better license. No one could take our source code and create a proprietary version of DOS. We changed the name to “Free-DOS” after another week or so. We later dropped the hyphen to become “FreeDOS.”
|
||||||
|
|
||||||
|
**Joshua Allen Holm: What are the advantages of using FreeDOS over alternative ways of running DOS applications (e.g., DOSBox)?**
|
||||||
|
|
||||||
|
Using DOSBox to run DOS applications in Linux is a great way to run certain DOS applications. But DOSBox is really intended to launch a single DOS program, like a game. The DOS command line is pretty limited in DOSBox.
|
||||||
|
|
||||||
|
In contrast, FreeDOS provides a full DOS command line. We include all of the commands you remember from classic DOS, and added other commands and utilities to do new things. FreeDOS also includes compilers and assemblers so developers can write new programs, utilities, and tools to make your DOS experience more useful, Internet programs to help you get on a network, and even open source games.
|
||||||
|
|
||||||
|
**JAH: Looking back over the years you have worked on FreeDOS, is there anything you would have done differently?**
|
||||||
|
|
||||||
|
There’s only one event that I wish I could take back. I occasionally reach out to companies that sold DOS applications in the 1980s and 1990s and ask them if they will release the source code to their old DOS programs under an open source software license. That’s a great way to contribute to the open source community.
|
||||||
|
|
||||||
|
One popular DOS program was a replacement for the MS-DOS COMMAND shell. 4DOS, by JP Software, was an extremely powerful DOS shell and included many modern features. For example, 4DOS supported built-in aliases, color-coded directory listings, and a “swapping” mechanism that freed up more conventional memory to run programs.
|
||||||
|
|
||||||
|
I contacted JP Software to ask if they would release the source code to 4DOS under an open source software license. JP Software had stopped supporting DOS, and instead focused on a similar replacement for the CMD shell in Windows NT, called 4NT. They were interested in releasing the source code to 4DOS but were concerned that someone might take the 4DOS source code and release a version for Windows. In effect, that would put JP Software in competition with their older product.
|
||||||
|
|
||||||
|
I still didn’t understand the fine points of open source software licenses, and I gave them bad advice. I suggested they might start with an existing open source license and add a term that said you could only run it on DOS. They then released the 4DOS source code under a modified version of the MIT license.
|
||||||
|
|
||||||
|
Unfortunately, limiting where you can run the software violates one of the tenets of open source software and free software. Users should be able to run open source software anywhere, and for any use. An open source license isn’t “open source” if you are limited to running it only on one operating system.
|
||||||
|
|
||||||
|
So despite best intentions, I gave JP Software really bad advice there, and 4DOS isn’t actually open source software. We used to include 4DOS in FreeDOS—but as we are preparing the FreeDOS 1.3 release, we want to be careful to only include open source software. So FreeDOS 1.3 RC4 (“release candidate 4”) does not include 4DOS.
|
||||||
|
|
||||||
|
**JAH: What are some interesting ways people are using FreeDOS?**
|
||||||
|
|
||||||
|
Over the years, I’ve seen people use FreeDOS to do a lot of really interesting things!
|
||||||
|
|
||||||
|
One of the earliest cool examples was someone who built pinball machines like you used to see in arcades. He embedded a version of FreeDOS to track the score and update the video screen on the back of the machine. I don’t know exactly how he did this, but my guess is every target or bumper on the pinball board probably generated a keyboard event. You can write a DOS application to read the “keyboard” and update the score based on that.
|
||||||
|
|
||||||
|
A few years ago, a user found a video of a train control system in Russia [that ran on a FreeDOS PC][6]. They rebooted the computer, and if you freeze the video at the right point, you can briefly see the FreeDOS kernel starting up. It disappears quickly, but you can see it at 0:07 in the video.
|
||||||
|
|
||||||
|
More recently, I saw someone had managed to boot an original IBM PC 5150 with FreeDOS [from a vinyl record][7], using the 5150’s rarely used cassette tape storage port. It’s really cool to see FreeDOS being used this way. It’s a method that I would never have thought to try, but sometimes you have to do something just for the fun of it.
|
||||||
|
|
||||||
|
**JAH: Why work on DOS in 2021?**
|
||||||
|
|
||||||
|
We still work on DOS in 2021 for a few reasons. I guess the first reason is that DOS is still interesting. We’ve added a lot to FreeDOS over the years. Where the original MS-DOS had a limited set of commands, FreeDOS includes dozens of useful utilities and tools, including editors, compilers, assemblers, games, and other neat programs.
|
||||||
|
|
||||||
|
But it has to be more than just a cool hobby. I find that working on FreeDOS makes for a very interesting programming challenge. In modern systems like Linux, you can take advantage of a lot of memory at once, and you can address it all in one big block. As a result, many programmers will load a lot of libraries and other code to create their projects. This is a very easy way to build a complicated project. You can build a very complex system in a very short time this way. And for many systems, time to market is the most important factor.
|
||||||
|
|
||||||
|
Loading a bunch of libraries and other code blocks is very inefficient, however. You may have the same basic functionality implemented half a dozen ways across the different libraries because each library implements something their own way. So your code grows and requires more memory.
|
||||||
|
|
||||||
|
Maybe that’s not a problem on a desktop PC. I run Linux, and my modern desktop PC has 32GB of memory. Loading a bunch of stuff into memory isn’t a big deal. But on a shared server, where you might have multiple instances of that project running, you’ll quickly run into memory limitations. How many instances can you run at the same time on a server? That 32GB of memory starts to look pretty slim.
|
||||||
|
|
||||||
|
You can’t load all of that into memory on a DOS machine. To remain compatible with the original DOS, FreeDOS has all the limitations of DOS. When MS-DOS was popular, a powerful PC might have had 4MB, 8MB, or even 16MB of extended memory. But the computer only had 640kb of “main” memory, due to how DOS addressed memory. And that’s megabytes and kilobytes, not gigabytes. A kilobyte is a thousand bytes (the basic unit of memory). A megabyte is a thousand kilobytes. And a gigabyte is a thousand megabytes. So today’s computers have memory that is about 1,000,000 more than a DOS computer.
|
||||||
|
|
||||||
|
By programming on a limited system like FreeDOS, you constantly have to think about the tradeoffs. How much memory does my program really need to do its job? Is it faster to read a file into memory to work on it, or process the file one bit at a time? And you’re always keeping in mind what libraries and other code you use in your program. A DOS program can only be so big, so you need to be careful about how you write a DOS program.
|
||||||
|
|
||||||
|
When you write DOS programs all the time, you get really good at optimizing a program. You think about programming in a different way, because you’re always considering how to do something more efficiently. That’s a challenge, but an interesting one.
|
||||||
|
|
||||||
|
**DW: How big is the FreeDOS community?**
|
||||||
|
|
||||||
|
FreeDOS was a very popular project throughout the 1990s and into the early 2000s, but the community isn’t as big these days. But it’s great that we are still an engaged and active group. If you look at the news items on our website, you’ll see we post updates on a fairly regular basis.
|
||||||
|
|
||||||
|
It’s hard to estimate the size of the community. I’d say we have a few dozen members who are very active. And we have a few dozen others who reappear occasionally to post new versions of their programs. I think to maintain an active community that’s still working on an open source DOS from 1994 is a great sign.
|
||||||
|
|
||||||
|
Some members have been with us from the very beginning, and I’m really thankful to count them as friends. We do [video hangouts on a semi-regular basis][8]. It’s great to finally “meet” the folks I’ve only exchanged emails with over the years.
|
||||||
|
|
||||||
|
It's meetings like this when I remember open source is more than just writing code; it's about a community. And while I've always done well with our virtual community that communicates via email, I really appreciated getting to talk to people without the asynchronous delay or artificial filter of email—making that real-time connection means a lot to me.
|
||||||
|
|
||||||
|
**DW: How does someone get involved in the community?**
|
||||||
|
|
||||||
|
I think our community is very welcoming, so anyone is free to join. We communicate via an email list, which you can find on the [FreeDOS website][9]. Join the freedos-user email list if you want to talk about FreeDOS or ask for help. Developers should join the freedos-devel email list; that’s where most of the FreeDOS developers hang out. Our email list volume is pretty low, so you aren’t likely to fill up your inbox by subscribing to either email list.
|
||||||
|
|
||||||
|
A great way to get started is by writing or updating documentation, or by fixing bugs. I think that’s true of pretty much every open source project out there. We always need folks to work on the documentation and fix bugs. But for a project like FreeDOS, I think reading through the documentation is important if you’re new to DOS. A common mistake for newcomers is thinking of FreeDOS as a stripped-down version of Linux, when in fact DOS uses a different memory and execution model. You can learn about that by reading the documentation, which is why I recommend new contributors start there.
|
||||||
|
|
||||||
|
For the more adventurous, we maintain a list of priority projects on our website. If you’d like to contribute to FreeDOS, but aren’t sure what needs work, you might consider tackling one or more of these projects:
|
||||||
|
|
||||||
|
* If you’ve got some programming experience:
|
||||||
|
* Port FreeDOS utilities to OpenWatcom C and NASM—our preferred C compiler and Assembler for FreeDOS. (Some older FreeDOS programs were probably written for Borland C or Turbo C or Microsoft C, or Microsoft ASM or Turbo ASM)
|
||||||
|
|
||||||
|
* Port GNU utilities to FreeDOS, such as using IA-16 GCC (while IA-16 GCC requires a ’386 or better to compile, programs compiled with IA-16 GCC run on all CPUs)
|
||||||
|
|
||||||
|
* Create a new alternative shell, similar to COMMAND.COM but with expanded BAT programming
|
||||||
|
|
||||||
|
* Add international language support to a FreeDOS program that currently only supports one language.
|
||||||
|
|
||||||
|
* If you’re a highly-skilled DOS developer:
|
||||||
|
* Write a guest tool like VMSMOUNT for VirtualBox
|
||||||
|
|
||||||
|
* Write a driver for modern sound cards
|
||||||
|
|
||||||
|
* Add some kind of UEFI bootstrap BIOS emulator, perhaps implemented as a CSM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
We like to make it easy for new contributors to get started in FreeDOS, and we welcome everyone who wants to work on FreeDOS. If you still don’t know how to contribute, feel free to ask on the email list.
|
||||||
|
|
||||||
|
You can find FreeDOS at [www.freedos.org][10]
|
||||||
|
Join FreeDOS on Facebook at [facebook.com/groups/freedos/][11]
|
||||||
|
Follow FreeDOS on Twitter at [twitter.com/freedos_project][12]
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/6/freedos-founder
|
||||||
|
|
||||||
|
作者:[Joshua Allen Holm][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/holmja
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen)
|
||||||
|
[2]: https://opensource.com/users/jim-hall
|
||||||
|
[3]: https://opensource.com/article/20/8/learn-open-source
|
||||||
|
[4]: https://opensource.com/article/17/8/linux-anniversary
|
||||||
|
[5]: https://groups.google.com/g/comp.os.msdos.apps/c/oQmT4ETcSzU/m/O1HR8PE2u-EJ?pli=1
|
||||||
|
[6]: https://www.youtube.com/watch?v=eAate0v8hDE
|
||||||
|
[7]: https://www.youtube.com/watch?v=bqz65_YfcJg
|
||||||
|
[8]: https://opensource.com/article/20/8/meet-open-source-collaborators
|
||||||
|
[9]: https://www.freedos.org/
|
||||||
|
[10]: http://www.freedos.org/
|
||||||
|
[11]: https://www.facebook.com/groups/freedos/
|
||||||
|
[12]: http://twitter.com/freedos_project
|
@ -1,129 +0,0 @@
|
|||||||
[#]: subject: (Copy files between Linux and FreeDOS)
|
|
||||||
[#]: via: (https://opensource.com/article/21/6/copy-files-linux-freedos)
|
|
||||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (geekpi)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Copy files between Linux and FreeDOS
|
|
||||||
======
|
|
||||||
Here's how I transfer files between my FreeDOS virtual machine and my
|
|
||||||
Linux desktop system.
|
|
||||||
![Files in a folder][1]
|
|
||||||
|
|
||||||
I run Linux as my primary operating system, and I boot FreeDOS in a virtual machine. Most of the time, I use QEMU as my PC emulator, but sometimes I'll run other experiments with GNOME Boxes (which uses QEMU as a back-end virtual machine) or with VirtualBox.
|
|
||||||
|
|
||||||
I like to play classic DOS games, and sometimes I'll bring up a favorite DOS application. I teach a Management Information Systems (MIS) class where I talk about the history of computing, and I'll sometimes record a demonstration using FreeDOS and a legacy DOS application, such as As-Easy-As (my favorite DOS spreadsheet—once released as "shareware" but now available [for free from TRIUS, Inc][2]).
|
|
||||||
|
|
||||||
But using FreeDOS this way means I need to transfer files between my FreeDOS virtual machine and my Linux desktop system. Let me show you how I do that.
|
|
||||||
|
|
||||||
### Accessing the image with guestmount
|
|
||||||
|
|
||||||
I used to access my virtual disk image by calculating the offset to the first DOS partition, then calling the Linux `mount` command with the right mix of options to match that offset. This was always error-prone and not very flexible. Fortunately, there's an easier way to do it. The `guestmount` program from the [libguestfs-tools][3] package lets you access or _mount_ the virtual disk image from Linux. You can install `libguestfs-tools` using this command on Fedora:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ yum install libguestfs-tools libguestfs`
|
|
||||||
```
|
|
||||||
|
|
||||||
Using `guestmount` is not as easy as double-clicking the file from the GNOME file manager, but the command line isn't too difficult to use. The basic usage of `guestmount` is:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ guestmount -a image -m device mountpoint`
|
|
||||||
```
|
|
||||||
|
|
||||||
In this usage, _image_ is the virtual disk image to use. On my system, I created my QEMU virtual disk image with the `qemu-img` command. The g`uestmount` program can read this disk image format, as well as the QCOW2 image format used by GNOME Boxes, or the VDI image format used in VirtualBox.
|
|
||||||
|
|
||||||
The _device_ option indicates the partition on the virtual disk. Imagine using this virtual disk as a real hard drive. You would access the first partition as `/dev/sda1`, the second partition as `/dev/sda2`, and so on. That's the syntax for `guestmount`. By default, FreeDOS 1.3 RC4 creates one partition on an empty drive, so access that partition as `/dev/sda1`.
|
|
||||||
|
|
||||||
And _mountpoint_ is the location to "mount" the DOS filesystem on your local Linux system. I'll usually create a temporary directory to work with. You only need the mount point while you're accessing the virtual disk.
|
|
||||||
|
|
||||||
Putting that all together, I use this set of commands to access my FreeDOS virtual disk image from Linux:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ mkdir /tmp/freedos
|
|
||||||
$ guestmount -a freedos.img -m /dev/sda1 /tmp/freedos
|
|
||||||
```
|
|
||||||
|
|
||||||
After that, I can access my FreeDOS files via the `/tmp/freedos` directory, using normal tools on Linux. I might use `ls /tmp/freedos` at the command line, or open the `/tmp/freedos` mount point using the desktop file manager.
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ls -l /tmp/freedos
|
|
||||||
total 216
|
|
||||||
drwxr-xr-x. 5 root root 8192 May 10 15:53 APPS
|
|
||||||
-rwxr-xr-x. 1 root root 85048 Apr 30 07:54 COMMAND.COM
|
|
||||||
-rwxr-xr-x. 1 root root 103 May 13 15:48 CONFIG.SYS
|
|
||||||
drwxr-xr-x. 5 root root 8192 May 15 16:52 DEVEL
|
|
||||||
drwxr-xr-x. 2 root root 8192 May 15 13:36 EDLIN
|
|
||||||
-rwxr-xr-x. 1 root root 1821 May 10 15:57 FDAUTO.BAT
|
|
||||||
-rwxr-xr-x. 1 root root 740 May 13 15:47 FDCONFIG.SYS
|
|
||||||
drwxr-xr-x. 10 root root 8192 May 10 15:49 FDOS
|
|
||||||
-rwxr-xr-x. 1 root root 46685 Apr 30 07:54 KERNEL.SYS
|
|
||||||
drwxr-xr-x. 2 root root 8192 May 10 15:57 SRC
|
|
||||||
-rwxr-xr-x. 1 root root 3190 May 16 08:34 SRC.ZIP
|
|
||||||
drwxr-xr-x. 3 root root 8192 May 11 18:33 TEMP
|
|
||||||
```
|
|
||||||
|
|
||||||
![GNOME file manager][4]
|
|
||||||
|
|
||||||
Using GNOME file manager to access the virtual disk
|
|
||||||
(Jim Hall, [CC-BY SA 4.0][5])
|
|
||||||
|
|
||||||
For example, to copy several C source files from my Linux `projects` directory into `C:\SRC` on the virtual disk image, so I can use the files under FreeDOS later, I can use the Linux `cp` command:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ cp /home/jhall/projects/*.c /tmp/freedos/SRC`
|
|
||||||
```
|
|
||||||
|
|
||||||
The files and directories on the virtual drive are technically _case insensitive_, so you can refer to them using uppercase or lowercase letters. However, I find it more natural to type DOS files and directories using all uppercase.
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ls /tmp/freedos
|
|
||||||
APPS CONFIG.SYS EDLIN FDCONFIG.SYS KERNEL.SYS SRC.ZIP
|
|
||||||
COMMAND.COM DEVEL FDAUTO.BAT FDOS SRC TEMP
|
|
||||||
|
|
||||||
$ ls /tmp/freedos/EDLIN
|
|
||||||
EDLIN.EXE MAKEFILE.OW
|
|
||||||
|
|
||||||
$ ls /tmp/freedos/edlin
|
|
||||||
EDLIN.EXE MAKEFILE.OW
|
|
||||||
```
|
|
||||||
|
|
||||||
### Unmounting with guestmount
|
|
||||||
|
|
||||||
You should always _unmount_ the virtual disk image before you use it again in your virtual machine. If you leave the image mounted while you run QEMU or VirtualBox, you risk messing up your files.
|
|
||||||
|
|
||||||
The companion command to `guestmount` is `guestunmount`, to unmount the disk image. Just give the mount point that you wish to unmount:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ guestunmount /tmp/freedos`
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that this command is spelled slightly differently from the Linux `umount` system command.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/6/copy-files-linux-freedos
|
|
||||||
|
|
||||||
作者:[Jim Hall][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/jim-hall
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder)
|
|
||||||
[2]: http://www.triusinc.com/forums/viewtopic.php?t=10
|
|
||||||
[3]: https://libguestfs.org/
|
|
||||||
[4]: https://opensource.com/sites/default/files/uploads/gnome-file-manager.png (Using GNOME file manager to access the virtual disk)
|
|
||||||
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
|
@ -1,139 +0,0 @@
|
|||||||
[#]: subject: (Forgot Linux Password on WSL? Here’s How to Reset it Easily)
|
|
||||||
[#]: via: (https://itsfoss.com/reset-linux-password-wsl/)
|
|
||||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (geekpi)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Forgot Linux Password on WSL? Here’s How to Reset it Easily
|
|
||||||
======
|
|
||||||
|
|
||||||
WSL (Windows Subsystem for Linux) is a handy tool for people who want to enjoy the power of Linux command line from the comfort of Windows.
|
|
||||||
|
|
||||||
When you [install Linux using WSL on Windows][1], you are asked to create a username and password. This user is automatically logged on when you start Linux on WSL.
|
|
||||||
|
|
||||||
Now, the problem is that if you haven’t used it for some time, you may forget the account password of WSL. And this will become a problem if you have to use a command with sudo because here you’ll need to enter the password.
|
|
||||||
|
|
||||||
![][2]
|
|
||||||
|
|
||||||
Don’t worry. You can easily reset it.
|
|
||||||
|
|
||||||
### Reset forgotten password for Ubuntu or any other Linux distribution on WSL
|
|
||||||
|
|
||||||
To reset the Linux password in WSL, you have to:
|
|
||||||
|
|
||||||
* Switch the default user to root
|
|
||||||
* Reset the password for the normal user
|
|
||||||
* Switch back the default user to the normal user
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Let me show you the steps in detail and with screenshots.
|
|
||||||
|
|
||||||
#### Step 1: Switch to root as default user
|
|
||||||
|
|
||||||
It will be wise to note down your account’s normal/regular username. As you can see, my regular account’s username is abhishek.
|
|
||||||
|
|
||||||
![Note down the account username][3]
|
|
||||||
|
|
||||||
The root user in WSL is unlocked and doesn’t have a password set. This means that you can switch to the root user and then use the power of root to reset the password.
|
|
||||||
|
|
||||||
Since you don’t remember the account password, switching to the root user is done by changing the configuration of your Linux WSL application and make it use root user by default.
|
|
||||||
|
|
||||||
This is done through Windows Command Prompt and you’ll need to know which command you need to run for your Linux distribution.
|
|
||||||
|
|
||||||
This information is usually provided in the description of the distribution app in the [Windows Store][4]. This is from where you had downloaded your distribution in the first place.
|
|
||||||
|
|
||||||
![Know the command to run for your distribution app][5]
|
|
||||||
|
|
||||||
From the Windows menu, start the command prompt:
|
|
||||||
|
|
||||||
![Start Command Prompt][6]
|
|
||||||
|
|
||||||
In here, use your distribution’s command in this fashion. If you were using the Ubuntu app from Windows store, the command would be:
|
|
||||||
|
|
||||||
```
|
|
||||||
ubuntu config --default-user root
|
|
||||||
```
|
|
||||||
|
|
||||||
In the screenshot, I am using Ubuntu 20.04 app from the Windows store. So, I have used ubuntu2004 command.
|
|
||||||
|
|
||||||
![Set root as default user in Linux app’s configuration][7]
|
|
||||||
|
|
||||||
To save you the trouble, I am listing some distributions and their respective commands in this table:
|
|
||||||
|
|
||||||
Distribution App | Windows Command
|
|
||||||
---|---
|
|
||||||
Ubuntu | ubuntu config –default-user root
|
|
||||||
Ubuntu 20.04 | ubuntu2004 config –default-user root
|
|
||||||
Ubuntu 18.04 | ubuntu1804 config –default-user root
|
|
||||||
Debian | debian config –default-user root
|
|
||||||
Kali Linux | kali config –default-user root
|
|
||||||
|
|
||||||
#### Step 2: Reset the password for the account
|
|
||||||
|
|
||||||
Now, if you start the Linux distribution app, you should be logged in as root. You can reset the password for the normal user account.
|
|
||||||
|
|
||||||
Do you remember the username in WSL? If not, you can always check the contents of the /home directory. When you have the username, use this command:
|
|
||||||
|
|
||||||
```
|
|
||||||
passwd username
|
|
||||||
```
|
|
||||||
|
|
||||||
It will ask you to enter a new password. **When you type here, nothing will be displayed on the screen. That’s normal. Just type the new password and hit enter.** You’ll have to retype the new password to confirm and once again, nothing will be displayed on the screen while you type the password.
|
|
||||||
|
|
||||||
![Reset the password for the regular user][8]
|
|
||||||
|
|
||||||
Congratulations. The password for the user account has been reset. But you are done just yet. The default user is still root. You should change it back to your regular account user, otherwise it will keep on logging in as root user.
|
|
||||||
|
|
||||||
#### Step 3: Set regular user as default again
|
|
||||||
|
|
||||||
You’ll need the regular account username that you used with the [passwd command][9] in the previous step.
|
|
||||||
|
|
||||||
Start the Windows command prompt once again. **Use your distribution’s command** in the similar manner you did in the step 1. However, this time, replace root with the regular user.
|
|
||||||
|
|
||||||
```
|
|
||||||
ubuntu config --default-user username
|
|
||||||
```
|
|
||||||
|
|
||||||
![Set regular user as default user][10]
|
|
||||||
|
|
||||||
Now when you start your Linux distribution app in WSL, you’ll be logged in as the regular user. You have reset the password fresh and can use it to run commands with sudo.
|
|
||||||
|
|
||||||
If you forgot the password again in the future, you know the steps to reset it.
|
|
||||||
|
|
||||||
### If resetting WSL password is this easy, is this not a security risk?
|
|
||||||
|
|
||||||
Not really. You need to have physical access to the computer along with access to the Windows account. If someone already has this much access, she/he can do a lot more than just changing the Linux password in WSL.
|
|
||||||
|
|
||||||
### Were you able to reset WSL password?
|
|
||||||
|
|
||||||
I gave you the commands and explained the steps. I hope this was helpful to you and you were able to reset the password of your Linux distribution in WSL.
|
|
||||||
|
|
||||||
If you are still facing issues or if you have a question on this topic, please feel free to ask in the comment section.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/reset-linux-password-wsl/
|
|
||||||
|
|
||||||
作者:[Abhishek Prakash][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://itsfoss.com/author/abhishek/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://itsfoss.com/install-bash-on-windows/
|
|
||||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/reset-wsl-password.png?resize=800%2C450&ssl=1
|
|
||||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/username-wsl.png?resize=800%2C296&ssl=1
|
|
||||||
[4]: https://www.microsoft.com/en-us/store/apps/windows
|
|
||||||
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/wsl-distro-command.png?resize=800%2C602&ssl=1
|
|
||||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/start-cmd-windows.jpg?resize=800%2C500&ssl=1
|
|
||||||
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/wsl-set-root-as-default.png?resize=800%2C288&ssl=1
|
|
||||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/resetting-wsl-password.png?resize=800%2C366&ssl=1
|
|
||||||
[9]: https://linuxhandbook.com/passwd-command/
|
|
||||||
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/set-regular-user-as-default-wsl.png?resize=800%2C288&ssl=1
|
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: (https://opensource.com/article/21/6/archive-files-freedos)
|
[#]: via: (https://opensource.com/article/21/6/archive-files-freedos)
|
||||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: (https://opensource.com/article/21/6/bash-config)
|
[#]: via: (https://opensource.com/article/21/6/bash-config)
|
||||||
[#]: author: (David Both https://opensource.com/users/dboth)
|
[#]: author: (David Both https://opensource.com/users/dboth)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: (https://opensource.com/article/21/6/osquery-linux)
|
[#]: via: (https://opensource.com/article/21/6/osquery-linux)
|
||||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (YungeG)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
[#]: subject: (Fotoxx: An Open Source App for Managing and Editing Large Photo Collection)
|
|
||||||
[#]: via: (https://itsfoss.com/fotoxx/)
|
|
||||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: ( )
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Fotoxx: An Open Source App for Managing and Editing Large Photo Collection
|
|
||||||
======
|
|
||||||
|
|
||||||
When it comes to [photo management software in Linux][1], Shotwell is perhaps the most famous of them all. No wonder it comes preinstalled in many distributions.
|
|
||||||
|
|
||||||
But if you are looking for a Shotwell like application which is a bit faster, Fotoxx could be a good choice.
|
|
||||||
|
|
||||||
It may not have a modern user interface, but it is fast in handling a large collection of photos. And it matters because indexing and showing thumbnails for thousands of photos could take considerable time and computing resources.
|
|
||||||
|
|
||||||
### Manage photos and edit them in Linux with Fotoxx
|
|
||||||
|
|
||||||
![Fotoxx interface][2]
|
|
||||||
|
|
||||||
As you can see in the screenshot above, it is not the nicest interface. Looks more like an application from around 2010. What it lacks in the visual department, it makes up with features and performance.
|
|
||||||
|
|
||||||
You can import a huge collection of photos, including RAW images. The images stay where they are. They are not copied or moved. They just get indexed in the application.
|
|
||||||
|
|
||||||
You can edit image metadata like tags, geotags, dates, ratings, captions etc. You can search images based on these matadata.
|
|
||||||
|
|
||||||
It also has a map feature that groups and displays images belonging to a certain location (based on geotag data on the images).
|
|
||||||
|
|
||||||
![Map view][3]
|
|
||||||
|
|
||||||
Since it focuses on managing large collection of photos, it has several batch functions to rename, resize, copy/move, convert image format and edit metadata.
|
|
||||||
|
|
||||||
You can select images to create albums and slideshows and all this happens without duplicating the images. Photos can be combined to create 360-degree panoramas.
|
|
||||||
|
|
||||||
Fotoxx also has several editing functions that can be used to retouch the images, add effect (like sketching, painting), trim, rotate and more.
|
|
||||||
|
|
||||||
There is also options for removing red eyes and dust spots from the old, scanned photo prints.
|
|
||||||
|
|
||||||
I can go on with the features list but it won’t end. Its website describes its full capabilities and you should check it out.
|
|
||||||
|
|
||||||
[Fotoxx Feature Overview][4]
|
|
||||||
|
|
||||||
If it interests you, you can watch this video that demonstrates the features of Fotoxx:
|
|
||||||
|
|
||||||
[Subscribe to It’s FOSS YouTube channel][5]
|
|
||||||
|
|
||||||
### Installing Fotoxx on Linux
|
|
||||||
|
|
||||||
Please keep in mind that **Fotoxx developer recommends a strong computer** with 4+ CPU cores, 16+ GB memory for proper functioning. Lesser computers may be slow or may fail to edit large images.
|
|
||||||
|
|
||||||
Fotoxx is available in the repositories of most Linux distributions like Debian, Ubuntu, Fedora and Arch Linux. Just use your distribution’s package manager or software center to search for Fotoxx and install it.
|
|
||||||
|
|
||||||
On Ubuntu and Debian based distributions, you can use the apt command to install it like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt install fotoxx
|
|
||||||
```
|
|
||||||
|
|
||||||
When you first run it, it will ask to search the home directory for images. You may continue with it or limit the search location to selected folders.
|
|
||||||
|
|
||||||
![][6]
|
|
||||||
|
|
||||||
I noticed that despite indexing over 4,700 in a minute or so, it didn’t start displaying the images immediately. I had to **click on Gallery->All Folders and the select the folder(s) and then it showed the images**. So, this is something to keep in mind.
|
|
||||||
|
|
||||||
Fotoxx is an extensive tool and it will take some time in getting used to it and explore all its features. Its webapge lists several examples that you should have a look at.
|
|
||||||
|
|
||||||
[Fotoxx Feature Examples][4]
|
|
||||||
|
|
||||||
As I said earlier, it is not the prettiest application, but it gets the job done with a huge list of features. If you are a photographer or have a large collection of images, you may give Fotoxx a try and see if it fits your need. And when you do that, please do share your experience with it in the comment section.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/fotoxx/
|
|
||||||
|
|
||||||
作者:[Abhishek Prakash][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://itsfoss.com/author/abhishek/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://itsfoss.com/linux-photo-management-software/
|
|
||||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/06/fotoxx-interface.jpg?resize=800%2C561&ssl=1
|
|
||||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/fotoxx-geotag-map-view.jpg?resize=800%2C466&ssl=1
|
|
||||||
[4]: https://kornelix.net/fotoxx/fotoxx.html
|
|
||||||
[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1
|
|
||||||
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/fotoxx-indexing.png?resize=800%2C617&ssl=1
|
|
@ -0,0 +1,325 @@
|
|||||||
|
[#]: subject: (Try Linux on any operating system with VirtualBox)
|
||||||
|
[#]: via: (https://opensource.com/article/21/6/try-linux-virtualbox)
|
||||||
|
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Try Linux on any operating system with VirtualBox
|
||||||
|
======
|
||||||
|
VirtualBox helps anyone—even a command line novice—set up a virtual
|
||||||
|
machine.
|
||||||
|
![Person programming on a laptop on a building][1]
|
||||||
|
|
||||||
|
VirtualBox makes it easy for anyone to try Linux. You don't even need experience with the command line to set up a simple virtual machine to tinker with Linux. I'm kind of a power user when it comes to virtual machines, but this article will show even novices how to virtualize a Linux system. In addition, it provides an overview of how to run and install a Linux system for testing purposes with the open source hypervisor [VirtualBox][2].
|
||||||
|
|
||||||
|
### Terms
|
||||||
|
|
||||||
|
Before starting, you should understand the difference between the two operating systems (OSes) in this setup:
|
||||||
|
|
||||||
|
* **Host system:** This is your actual OS on which you install VirtualBox.
|
||||||
|
* **Guest system:** This is the system you want to run virtualized on top of your host system.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Both systems, host and guest, must interact with each other when it comes to input/output, networking, file access, clipboard, audio, and video.
|
||||||
|
|
||||||
|
In this tutorial, I'll use Windows 10 as the _host system_ and [Fedora 33][3] as the _guest system_.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
When we talk about virtualization, we actually mean [hardware-assisted virtualization][4]. Hardware-assisted virtualization requires a compatible CPU. Almost every ordinary x86 CPU from the last decade comes which this feature. AMD calls it **AMD-V,** and Intel calls it **VT-x**. The virtualization feature adds some additional CPU instructions, and it can be enabled or disabled in the BIOS.
|
||||||
|
|
||||||
|
To start with virtualization:
|
||||||
|
|
||||||
|
* Make sure that AMD-V or VT-x is enabled in the BIOS.
|
||||||
|
* Download and install [VirtualBox][5].
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Prepare the virtual machine
|
||||||
|
|
||||||
|
Download the image of the Linux distribution you want to try out. It does not matter if it's a 32-bit or 64-bit OS image. You can even start a 64-bit OS image on a 32-bit host system (with limitations in memory usage, of course) and vice versa.
|
||||||
|
|
||||||
|
> **Considerations:** If possible, choose a Linux distribution that comes with the [Logical Volume Manager][6] (LVM). LVM decouples the filesystem from the physical hard drives. This allows you to increase the size of your guest system's hard drive if you are running out of space.
|
||||||
|
|
||||||
|
Now, open VirtualBox and click on the yellow **New** button:
|
||||||
|
|
||||||
|
![VirtualBox New VM][7]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Next, configure how much memory the guest OS is allowed to use:
|
||||||
|
|
||||||
|
![Set VM memory size][9]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
My recommendation: **Don't skimp on memory!** When memory is low, the guest system will start paging memory from RAM to the hard drive, worsening the system's performance and responsiveness extremely. If the underlying host system starts paging, you might not notice. For a Linux workstation system with a graphical desktop environment, I recommend at least 4GB of memory.
|
||||||
|
|
||||||
|
Next, create the hard disk:
|
||||||
|
|
||||||
|
![Create virtual hard disk][10]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Choose the default option, **VDI**:
|
||||||
|
|
||||||
|
![Selecting hard disk file type][11]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
In this window, I recommend choosing **dynamically allocated**, as this allows you to increase the size later. If you choose **fixed size**, the disk will be probably faster, but you won't be able to modify it:
|
||||||
|
|
||||||
|
![Dynamically allocating hard disk][12]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
With a Linux distribution that uses LVM, you can start with a small hard disk. If you are running out of space, you can increase it on demand.
|
||||||
|
|
||||||
|
> **Note**: Fedora's website says [it requires][13] a minimum of 20GB free disk space. I highly recommend you stick to that specification. I chose 8GB here so that I can demonstrate how to increase it later. If you are new to Linux or inexperienced with the command line, choose 20GB.
|
||||||
|
|
||||||
|
![Setting hard disk size][14]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
After creating the hard drive, select the newly created virtual machine from the list in VirtualBox's main window and click on **Settings**. In the Settings menu, go to **System** and select the **Processor** tab. By default, VirtualBox assigns only one CPU core to the guest system. On a modern multicore CPU, it should not be any problem to assign at least two cores, which will speed up the guest system significantly:
|
||||||
|
|
||||||
|
![Assigning cores to guest system][15]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
#### Network adapter setup
|
||||||
|
|
||||||
|
The next thing to take care of is the network setup. By default, VirtualBox creates one NAT connection, which should be OK for most use cases:
|
||||||
|
|
||||||
|
![Network settings][16]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
You can create more than one network adapter. Here are the most common types:
|
||||||
|
|
||||||
|
* **NAT:** The NAT adapter performs a [network address translation][17]. From the outside, it looks like the host and the guest system use the same IP address. You are not able to access the guest system from within the host system over the network. (Although you could define [port forwarding][18] to access certain services.) When your host system has access to the internet, the guest system will have access, too. NAT requires no further configuration.
|
||||||
|
* _Choose **NAT** if you only need internet access for the guest system._
|
||||||
|
* **Bridged adapter:** Here, the guest and the host system share the same physical Ethernet device. Both systems will have independent IP addresses. From the outside, it looks like there are two separate systems in the network, both sharing the same physical Ethernet adapter. This setup is more flexible but requires more configuration.
|
||||||
|
* _Choose **Bridged adapter** if you want to share the guest system's network services._
|
||||||
|
* **Host-only adapter:** In this configuration, the guest system can only talk to the host or other guest systems running on the same host. The host system can also connect to the guest system. There is no internet nor physical network access for the guest.
|
||||||
|
* _Choose **Host-only adapter** for advanced security._
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Assign the OS image
|
||||||
|
|
||||||
|
Navigate to **Storage** and select the virtual optical drive. Click on the **CD icon** on the right, and select **Choose a disk file…**. Then assign the downloaded Linux distribution image you want to install:
|
||||||
|
|
||||||
|
![Assigning OS image][19]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
### Install Linux
|
||||||
|
|
||||||
|
The virtual machine is now configured. Leave the **Settings** menu and go back to the main window. Click on the **Green arrow** (i.e., the start button). The virtual machine will start up and boot from the virtual optical drive, and you will find yourself in your Linux distribution's installer:
|
||||||
|
|
||||||
|
![VirtualBox Fedora installer][20]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
#### Partitioning
|
||||||
|
|
||||||
|
The installer will ask you for partitioning information during the installation process. Choose **Custom**:
|
||||||
|
|
||||||
|
![Selecting Custom partition configuration][21]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
> **Note:** I'm assuming you're creating this virtual machine just for testing purposes. Also you don't need to care about hibernation for your guest system, as this function is implicitly provided by VirtualBox. Therefore, you can omit the swap partition to save disk space on your host system. Keep in mind that you can add a swap partition later if needed. In [_An introduction to swap space on Linux systems_][22], David Both explains how to add a swap partition and choose the correct size.
|
||||||
|
|
||||||
|
Fedora 33 and later offer a [zram][23] partition, a compressed part of the memory used for paging and swap. The zram partition is resized on demand, and it is much faster than a hard disk swap partition.
|
||||||
|
|
||||||
|
To keep it simple, just add these two mount points:
|
||||||
|
|
||||||
|
![Adding mount points][24]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Apply the changes and proceed with the installation.
|
||||||
|
|
||||||
|
### Install VirtualBox Guest Additions
|
||||||
|
|
||||||
|
After you finish the installation, boot from the hard drive and log in. Now you can install VirtualBox Guest Additions, which include special device drivers and system applications that provide:
|
||||||
|
|
||||||
|
* Shared clipboard
|
||||||
|
* Shared folders
|
||||||
|
* Better performance
|
||||||
|
* Freely scalable window size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
To install them, click on the top menu in **Devices** and select **Insert Guest Additions CD image…**:
|
||||||
|
|
||||||
|
![Selecting Guest Additions CD image][25]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
On most Linux distributions, the CD image with the Guest Additions is mounted automatically, and they are available in the file browser. Fedora will ask you if you want to run the installation script. Click **Run** and enter your credentials to grant the process root rights:
|
||||||
|
|
||||||
|
![Enabling Guest Additions autorun][26]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
When the installation is finished, reboot the system.
|
||||||
|
|
||||||
|
### LVM: Enlarge disk space
|
||||||
|
|
||||||
|
Creating an 8GB hard disk was a dumb decision, as Fedora quickly starts signaling that it is running out of space:
|
||||||
|
|
||||||
|
![Fedora hard disk running out of space][27]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
As I mentioned, a disk space of 20GB is recommended, and 8GB is the _absolute_ minimum for a Fedora 33 installation to boot up. A fresh installation with no additional software (except the VirtualBox Guest Additions) takes nearly the whole 8GB of available space. Don't open the GNOME Software center or anything else that might download files from the internet in this condition.
|
||||||
|
|
||||||
|
Luckily, I chose to use LVM, so I can easily fix this mishap.
|
||||||
|
|
||||||
|
To increase the filesystem's space within the virtual machine, you must first increase the virtual hard drive on your host system.
|
||||||
|
|
||||||
|
Shut down the virtual machine. If your host system is running Windows, open a command prompt and navigate to `C:\Program Files\Oracle\VirtualBox`. Resize the disk to 12,000MB with the following command:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`VBoxManage.exe modifyhd "C:\Users\StephanA\VirtualBox VMs\Fedora_33\Fedora_33.vdi" --resize 12000`
|
||||||
|
```
|
||||||
|
|
||||||
|
Boot the virtual machine and open the **Disks** utility. You should see the newly created unassigned free space. Select **Free Space** and click the **+** button:
|
||||||
|
|
||||||
|
![Free space before adding][28]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Now, create a new partition. Select the amount of free space you want to use:
|
||||||
|
|
||||||
|
![Creating a new partition and setting size][29]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
You don't want to create a filesystem or anything else on your new partition, so select **Other**:
|
||||||
|
|
||||||
|
![Selecting "other" for partition volume type][30]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Select **No Filesystem**:
|
||||||
|
|
||||||
|
![Setting "No filesystem" on new partition][31]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
The overview should now look like this:
|
||||||
|
|
||||||
|
![VirtualBox after adding new partition][32]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
There is a new partition device, **/dev/sda3**. Check your LVM volume group by typing `vgscan`:
|
||||||
|
|
||||||
|
![Checking LVM volume group by typing vgscan:][33]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Now you have everything you need. Extend the volume group in the new partition:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`vgextend fedora_localhost-live /dev/sda3`
|
||||||
|
```
|
||||||
|
|
||||||
|
![vgextend command output][34]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Because the volume group is larger, you can increase the size of the logical volume. The command `vgdisplay` shows that it has 951 free extends available:
|
||||||
|
|
||||||
|
![vgdisplay command output][35]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Increase the logical volume by 951 extends:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`lvextend -l+951 /dev/mapper/fedora_localhost--live-root`
|
||||||
|
```
|
||||||
|
|
||||||
|
![lvextend command output][36]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
After you increase the logical volume, the last thing to do is to resize the filesystem:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`resize2fs /dev/mapper/fedora_localhost--live-root`
|
||||||
|
```
|
||||||
|
|
||||||
|
![resize2fs command output][37]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
Done! Check the **Disk Usage Analyzer**, and you should see that the extended space is available for the filesystem.
|
||||||
|
|
||||||
|
### Summary
|
||||||
|
|
||||||
|
With a virtual machine, you can check how a piece of software behaves with a specific operating system or a specific version of an operating system. Besides that, you can also try out any Linux distribution you want to test without worrying about breaking your system. For advanced users, VirtualBox offers a wide range of possibilities when it comes to testing, networking, and simulation.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/6/try-linux-virtualbox
|
||||||
|
|
||||||
|
作者:[Stephan Avenwedde][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/hansic99
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building)
|
||||||
|
[2]: https://www.virtualbox.org/
|
||||||
|
[3]: https://getfedora.org/
|
||||||
|
[4]: https://en.wikipedia.org/wiki/Hardware-assisted_virtualization
|
||||||
|
[5]: https://www.virtualbox.org/wiki/Downloads
|
||||||
|
[6]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
|
||||||
|
[7]: https://opensource.com/sites/default/files/uploads/virtualbox_new_vm.png (VirtualBox New VM)
|
||||||
|
[8]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[9]: https://opensource.com/sites/default/files/uploads/virtualbox_memory_size_1.png (Set VM memory size)
|
||||||
|
[10]: https://opensource.com/sites/default/files/uploads/virtualbox_create_hd_1.png (Create virtual hard disk)
|
||||||
|
[11]: https://opensource.com/sites/default/files/uploads/virtualbox_create_hd_2.png (Selecting hard disk file type)
|
||||||
|
[12]: https://opensource.com/sites/default/files/uploads/virtualbox_create_hd_3.png (Dynamically allocating hard disk)
|
||||||
|
[13]: https://getfedora.org/en/workstation/download/
|
||||||
|
[14]: https://opensource.com/sites/default/files/uploads/virtualbox_create_hd_4.png (Setting hard disk size)
|
||||||
|
[15]: https://opensource.com/sites/default/files/uploads/virtualbox_cpu_settings.png (Assigning cores to guest system)
|
||||||
|
[16]: https://opensource.com/sites/default/files/uploads/virtualbox_network_settings2.png (Network settings)
|
||||||
|
[17]: https://en.wikipedia.org/wiki/Network_address_translation
|
||||||
|
[18]: https://www.virtualbox.org/manual/ch06.html#natforward
|
||||||
|
[19]: https://opensource.com/sites/default/files/uploads/virtualbox_choose_image3.png (Assigning OS image)
|
||||||
|
[20]: https://opensource.com/sites/default/files/uploads/virtualbox_running.png (VirtualBox Fedora installer)
|
||||||
|
[21]: https://opensource.com/sites/default/files/uploads/virtualbox_partitioning_1.png (Selecting Custom partition configuration)
|
||||||
|
[22]: https://opensource.com/article/18/9/swap-space-linux-systems
|
||||||
|
[23]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM
|
||||||
|
[24]: https://opensource.com/sites/default/files/uploads/virtualbox_partitioning_2.png (Adding mount points)
|
||||||
|
[25]: https://opensource.com/sites/default/files/uploads/virtualbox_guest_additions_2.png (Selecting Guest Additions CD image)
|
||||||
|
[26]: https://opensource.com/sites/default/files/uploads/virtualbox_guest_additions_autorun.png (Enabling Guest Additions autorun)
|
||||||
|
[27]: https://opensource.com/sites/default/files/uploads/virtualbox_disk_usage_1.png (Fedora hard disk running out of space)
|
||||||
|
[28]: https://opensource.com/sites/default/files/uploads/virtualbox_disks_before.png (Free space before adding)
|
||||||
|
[29]: https://opensource.com/sites/default/files/uploads/virtualbox_new_partition_1.png (Creating a new partition and setting size)
|
||||||
|
[30]: https://opensource.com/sites/default/files/uploads/virtualbox_new_partition_2.png (Selecting "other" for partition volume type)
|
||||||
|
[31]: https://opensource.com/sites/default/files/uploads/virtualbox_no_partition_3.png (Setting "No filesystem" on new partition)
|
||||||
|
[32]: https://opensource.com/sites/default/files/uploads/virtualbox_disk_after.png (VirtualBox after adding new partition)
|
||||||
|
[33]: https://opensource.com/sites/default/files/uploads/virtualbox_vgscan.png (Checking LVM volume group by typing vgscan:)
|
||||||
|
[34]: https://opensource.com/sites/default/files/uploads/virtualbox_vgextend_2.png (vgextend command output)
|
||||||
|
[35]: https://opensource.com/sites/default/files/uploads/virtualbox_vgdisplay.png (vgdisplay command output)
|
||||||
|
[36]: https://opensource.com/sites/default/files/uploads/virtualbox_lvextend.png (lvextend command output)
|
||||||
|
[37]: https://opensource.com/sites/default/files/uploads/virtualbox_resizefs.png (resize2fs command output)
|
@ -0,0 +1,209 @@
|
|||||||
|
[#]: subject: (9 reasons I love to use the Qt Creator IDE)
|
||||||
|
[#]: via: (https://opensource.com/article/21/6/qtcreator)
|
||||||
|
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
9 reasons I love to use the Qt Creator IDE
|
||||||
|
======
|
||||||
|
Qt Creator is the glue between Qt's rich set of libraries and the
|
||||||
|
programmer.
|
||||||
|
![Business woman on laptop sitting in front of window][1]
|
||||||
|
|
||||||
|
Qt Creator is the Qt framework's default integrated development environment (IDE) and hence the glue between Qt's rich set of libraries and the user. In addition to its basic features such as intelligent code completion, debugging, and project administration, Qt Creator offers a lot of nice features that make software development easier.
|
||||||
|
|
||||||
|
In this article, I will highlight some of my favorite [Qt Creator][2] features.
|
||||||
|
|
||||||
|
### Dark mode
|
||||||
|
|
||||||
|
My first question when working with a new application is: _Is there a dark mode?_ Qt Creator answers with: _Which dark mode do you prefer?_
|
||||||
|
|
||||||
|
You can activate dark mode in the Options menu. On the top menu bar, go to **Tools**, select **Options**, and go to the **Environment** section. Here is where you can select the general appearance:
|
||||||
|
|
||||||
|
![ QT Creator dark mode][3]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
### Custom appearance
|
||||||
|
|
||||||
|
Like every Qt application, Qt Creator's appearance is highly customizable with style sheets. Below, you can follow along with my approach to give Qt Creator a fancy look.
|
||||||
|
|
||||||
|
Create the file `mycustomstylesheet.css` with the following content:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
QMenuBar { background-color: olive }
|
||||||
|
QMenuBar::item { background-color: olive }
|
||||||
|
QMenu { background-color : beige; color : black }
|
||||||
|
QLabel { color: green }
|
||||||
|
```
|
||||||
|
|
||||||
|
Then start Qt Creator from the command line and pass the style sheet as a parameter with:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`qtcreator -stylesheet=mycustomstylesheet.css`
|
||||||
|
```
|
||||||
|
|
||||||
|
It should look like this:
|
||||||
|
|
||||||
|
![QT Creator custom stylesheet][5]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
Read more about style sheets in the [documentation][6].
|
||||||
|
|
||||||
|
### Command-line parameters
|
||||||
|
|
||||||
|
Qt Creator accepts many command-line options. For example, if you want to automatically load your current project at startup, pass the path to the `*.pro-file`:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`qtcreator ~/MyProject/MyQtProject.pro`
|
||||||
|
```
|
||||||
|
|
||||||
|
You can even pass the file and the line number that should be opened by default. This command opens the file `main.cpp` at line 20:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`qtcreator ~/MyProject/main.cpp:20`
|
||||||
|
```
|
||||||
|
|
||||||
|
Read more about the Qt Creator-specific command-line options in the [documentation][7].
|
||||||
|
|
||||||
|
Qt Creator is an ordinary Qt application, so, in addition to its own command-line arguments, it also accepts the generic arguments for [QApplication][8] and [QGuiApplication][9].
|
||||||
|
|
||||||
|
### Cross-compiling
|
||||||
|
|
||||||
|
Qt Creator allows you to define several toolchains, called **Kits**. A kit defines the binaries and SDK for building and running an application:
|
||||||
|
|
||||||
|
![QT Creator kits][10]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
This allows you to switch between completely different toolchains with just two clicks:
|
||||||
|
|
||||||
|
![Switching between Kits in Qt Creator][11]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
Read more about kits in the [manual][12].
|
||||||
|
|
||||||
|
### Analyzer
|
||||||
|
|
||||||
|
Qt Creator integrates several of the most popular analyzers, such as:
|
||||||
|
|
||||||
|
* [Linux Performance Analyzer][13] (requires a special kernel)
|
||||||
|
* [Valgrind][14] memory profiler
|
||||||
|
* [Clang-Tidy and Clazy][15], a linter for C/C++
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
![Qt Creator analyzer][16]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
### Debugger
|
||||||
|
|
||||||
|
When it comes to debugging, Qt Creator has a nice interface for GNU Debugger (GDB). I like its easy way of inspecting container types and creating conditional breakpoints:
|
||||||
|
|
||||||
|
![Qt Creator debugger][17]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
### FakeVim
|
||||||
|
|
||||||
|
If you like Vim, enable FakeVim in the settings to control Qt Creator like Vim. Go to **Tools** and select **Options**. In the **FakeVim** section, you can find many switches to customize FakeVim's behavior. In addition to the editor functions, you can also map your own functions to custom Vim commands.
|
||||||
|
|
||||||
|
For example, you can map the function **Build Project** to the `build` command:
|
||||||
|
|
||||||
|
![FakeVim in Qt Creator][18]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
Back in the editor, when you press the colon button and enter `build`, Qt Creator starts a build process with the configured toolchain:
|
||||||
|
|
||||||
|
![FakeVim in Qt Creator][19]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
You can find more information about FakeVim [in the docs][20].
|
||||||
|
|
||||||
|
### Class inspector
|
||||||
|
|
||||||
|
When developing in C++, open the right window by clicking on the button in the bottom-right corner of Qt Creator. Then choose **Outline** from the dropdown menu on the top border. If you have a header file open on the left pane, you get a nice overview of the defined classes or types. If you switch to a source file (`*.cpp`), the right pane will list all defined methods, and you can jump to one by double-clicking on it:
|
||||||
|
|
||||||
|
![List of classes in Qt Creator][21]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
### Project configuration
|
||||||
|
|
||||||
|
Qt Creator projects are built around the `*.pro-file` in the project's directory. You can add your own custom configuration to the project's `*.pro-file` of your project. I added `my_special_config` to the `*.pro-file`, which adds `MY_SPECIAL_CONFIG` to the compiler defined:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
QT -= gui
|
||||||
|
|
||||||
|
CONFIG += c++11 console
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
|
CONFIG += my_special_config
|
||||||
|
|
||||||
|
my_special_config {
|
||||||
|
DEFINES += MY_SPECIAL_CONFIG
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Qt Creator automatically highlights the code according to the active configuration:
|
||||||
|
|
||||||
|
![Special configuration in Qt Creator][22]
|
||||||
|
|
||||||
|
(Stephan Avenwedde, [CC BY-SA 4.0][4])
|
||||||
|
|
||||||
|
The `*.pro-file` is written in the [qmake language][23].
|
||||||
|
|
||||||
|
### Summary
|
||||||
|
|
||||||
|
These features are only the tip of the iceberg of what Qt Creator provides. Beginners shouldn't feel overwhelmed by the many features, as Qt Creator is absolutely beginner-friendly. It may even be the easiest way to start developing in C++. To get a complete overview of its features, refer to the [official Qt Creator documentation][24].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/6/qtcreator
|
||||||
|
|
||||||
|
作者:[Stephan Avenwedde][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/hansic99
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||||
|
[2]: https://www.qt.io/product/development-tools
|
||||||
|
[3]: https://opensource.com/sites/default/files/uploads/qt_creator_dark_mode.png ( QT Creator dark mode)
|
||||||
|
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[5]: https://opensource.com/sites/default/files/uploads/qt_creator_custom_stylesheet2.png (QT Creator custom stylesheet)
|
||||||
|
[6]: https://doc.qt.io/qt-5/stylesheet-reference.html
|
||||||
|
[7]: https://doc.qt.io/qtcreator/creator-cli.html
|
||||||
|
[8]: https://doc.qt.io/qt-5/qapplication.html#QApplication
|
||||||
|
[9]: https://doc.qt.io/qt-5/qguiapplication.html#supported-command-line-options
|
||||||
|
[10]: https://opensource.com/sites/default/files/uploads/qt_creator_cross_compiling.png (QT Creator kits)
|
||||||
|
[11]: https://opensource.com/sites/default/files/uploads/qt_creator_select_kits.png (Switching between Kits in Qt Creator)
|
||||||
|
[12]: https://doc.qt.io/qtcreator/creator-targets.html
|
||||||
|
[13]: https://doc.qt.io/qtcreator/creator-cpu-usage-analyzer.html
|
||||||
|
[14]: https://doc.qt.io/qtcreator/creator-valgrind-overview.html
|
||||||
|
[15]: https://doc.qt.io/qtcreator/creator-clang-tools.html
|
||||||
|
[16]: https://opensource.com/sites/default/files/uploads/qt_creator_analyzer.png (Qt Creator analyzer)
|
||||||
|
[17]: https://opensource.com/sites/default/files/uploads/qt_creator_debugger2.png (Qt Creator debugger)
|
||||||
|
[18]: https://opensource.com/sites/default/files/uploads/qt_creator_fakevim_ex_commands.png (FakeVim in Qt Creator)
|
||||||
|
[19]: https://opensource.com/sites/default/files/uploads/qt_creator_fakevim_build_commands.png (FakeVim in Qt Creator)
|
||||||
|
[20]: https://doc.qt.io/qtcreator/creator-editor-fakevim.html
|
||||||
|
[21]: https://opensource.com/sites/default/files/uploads/qtcreator_class_overview.png (List of classes in Qt Creator)
|
||||||
|
[22]: https://opensource.com/sites/default/files/uploads/qtcreater_special_config.png (Special configuration in Qt Creator)
|
||||||
|
[23]: https://doc.qt.io/qt-5/qmake-language.html
|
||||||
|
[24]: https://doc.qt.io/qtcreator/
|
139
sources/tech/20210630 Is remmina useful for your daily work.md
Normal file
139
sources/tech/20210630 Is remmina useful for your daily work.md
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
[#]: subject: (Is remmina useful for your daily work?)
|
||||||
|
[#]: via: (https://fedoramagazine.org/is-remmina-useful-for-your-daily-work/)
|
||||||
|
[#]: author: (zexcon https://fedoramagazine.org/author/zexcon/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Is remmina useful for your daily work?
|
||||||
|
======
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
Photo by [Oğuzhan Akdoğan][2] on [Unsplash][3]
|
||||||
|
|
||||||
|
[Remmina][4] is a Remote Desktop Client that supports numerous protocols allowing you to connect to many remote systems. This full featured client program allows you to set up a shared folder, select the screen size and type of connection being used. There are many more options that give you the ability to customize your connection to fit your individual needs. In this article we will utilize Remote Desktop Protocol (RDP) to demonstrate its capabilities. RDP is commonly used for logging into Microsoft Windows machines remotely and that will be used as an example.
|
||||||
|
|
||||||
|
### How I came to use remmina
|
||||||
|
|
||||||
|
Using _remmina_ has become a staple of my work and personal life. At one point I’m sitting at my desk looking at a 13″ monitor trying to perform work on an inadequate laptop. To my left is a 34″ ultra-wide connected to my personal box running Fedora Linux. Then it dawned on me, I should see if I can remote in and use my 34″ monitor to make my life better and offload resource intensive processes. The answer is yes, maybe? Lets try it out and see if it works for you.
|
||||||
|
|
||||||
|
### Installing remmina
|
||||||
|
|
||||||
|
The _remmina_ software is available in the Fedora Linux repository by default. Install it by running the following.
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
sudo dnf install remmina
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Collecting Windows Information
|
||||||
|
|
||||||
|
On the the Windows computer you are going to remote into you will need to get the IP address, domain name and username. Type the _Windows Key + r_ and this will display the run box. Type _cmd_ and select OK.
|
||||||
|
|
||||||
|
![][5]
|
||||||
|
|
||||||
|
The terminal (command line) displayed allows us to obtain the IP address. At the prompt type _ipconfig_.
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
ipconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
You will see options labeled “IPv6 Address” or “IPv4 Address” or both. Keep this address handy for the next section. In the terminal enter _set user_ to obtain the Server, Domain and Username.
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
set user
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
This displays the USERDOMAIN and USERNAME. Make note of this along with the IP address you captured in the last step. You will have the following three items.
|
||||||
|
|
||||||
|
* Server = IPv4 or IPv6
|
||||||
|
* USERDOMAIN = Domain
|
||||||
|
* USERNAME = Username
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
With these three pieces of information you are ready to move to creating the connection.
|
||||||
|
|
||||||
|
### Running remmina
|
||||||
|
|
||||||
|
Execute the following command to start _remmina:_
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
remmina
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
![Remnina startup screen][6]
|
||||||
|
|
||||||
|
### Creating the connection
|
||||||
|
|
||||||
|
Lets look at creating a connection. Select the icon to the left of the magnifying class at the top to create a connection profile (middle icon of the three).
|
||||||
|
|
||||||
|
![][7]
|
||||||
|
|
||||||
|
In the Remote Connection Profile you provide all the options to create the connection. Provide a meaningful title under the Name field. You can also add your connection to a Group if you are going to manage several connections with _remmina_. For the Protocol select “RDP – Remote Desktop Protocol”.
|
||||||
|
|
||||||
|
Under the Basic options you will need to provide your IPv4 or IPv6 address for the host computer, your login name for the Username and the corresponding password. Use of the Domain will be specific to your situation and may not be needed.
|
||||||
|
|
||||||
|
At this point, you are ready to connect to your remote desktop and can click “Save and Connect” at the bottom or you can continue reading and learn about some of the additional options.
|
||||||
|
|
||||||
|
### The fun stuff “options”
|
||||||
|
|
||||||
|
Here is where all the fun begins. Under Basic you can select Enable multi monitor, Span screen over multiple monitors and List monitor IDs. This allows you to use one or more monitors in many different configurations. You can even set the resolution or select a Color depth.
|
||||||
|
|
||||||
|
One of my favorite options available is the Share folder that allows you to setup a folder on your local machine and it will automatically mount on the remote computer. This affords you the opportunity to move files back and forth easily and no more emailing yourself!
|
||||||
|
|
||||||
|
![][8]
|
||||||
|
|
||||||
|
We will only cover two items under the Advanced section one is Quality and allows you to select performance over visual appeal or vise versa. The second option is the security protocol negotiation that I recommend leaving set to Automatic negotiation.
|
||||||
|
|
||||||
|
![][9]
|
||||||
|
|
||||||
|
### Alternative
|
||||||
|
|
||||||
|
In all fairness I didn’t start with _remmina_. It took using others, notably [FreeRDP,][10] for me to see that the learning curve could be substantial and I didn’t want it to effect my availability and productivity at work. With a little bit of time and research you can dig in and learn the many features of FreeRDP and see if it might be the better choice for you.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
A basic setup for an RDP connection to a Windows system was described. Some options were discussed, such as setting the Resolution, Share folder, and Quality. We only touched on a minimal set available among an abundance of options. If you find that _remmina_ is right for you, I highly recommend you go through the remaining options. Many of the options can help tweak the desktop to fit your personal preferences and create a better experience.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://fedoramagazine.org/is-remmina-useful-for-your-daily-work/
|
||||||
|
|
||||||
|
作者:[zexcon][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://fedoramagazine.org/author/zexcon/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://fedoramagazine.org/wp-content/uploads/2021/06/remote_display-816x345.jpg
|
||||||
|
[2]: https://unsplash.com/@jeffgry?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||||
|
[3]: https://unsplash.com/s/photos/remote-display?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||||
|
[4]: https://remmina.org/
|
||||||
|
[5]: https://fedoramagazine.org/wp-content/uploads/2021/06/Remmina05.jpg
|
||||||
|
[6]: https://fedoramagazine.org/wp-content/uploads/2021/06/Remmina01.jpg
|
||||||
|
[7]: https://fedoramagazine.org/wp-content/uploads/2021/06/Remmina02.jpg
|
||||||
|
[8]: https://fedoramagazine.org/wp-content/uploads/2021/06/Rammina03.jpg
|
||||||
|
[9]: https://fedoramagazine.org/wp-content/uploads/2021/06/Remmina04.jpg
|
||||||
|
[10]: https://www.freerdp.com/
|
@ -0,0 +1,312 @@
|
|||||||
|
[#]: subject: (Parse JSON configuration files with Groovy)
|
||||||
|
[#]: via: (https://opensource.com/article/21/6/groovy-parse-json)
|
||||||
|
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Parse JSON configuration files with Groovy
|
||||||
|
======
|
||||||
|
Sidestep the debate on whether or not to use JSON as a configuration
|
||||||
|
format and just learn how to parse it using Groovy.
|
||||||
|
![Looking back with binoculars][1]
|
||||||
|
|
||||||
|
Applications typically include some type of default or "out-of-the-box" state or configuration, as well as some way for users to customize that configuration for their needs.
|
||||||
|
|
||||||
|
For example, [LibreOffice Writer][2] gives access to stuff like user data, fonts, language settings, and (much) more through **Tools > Options** on its menu bar. Some applications (like LibreOffice) provide a point-and-click user interface to manage these settings. Some, like [Tracker][3] (the GNOME task that indexes files), use XML files. And some, especially JavaScript-based applications, use JSON, despite the protestations of many (for example, [this writer][4] and [this other writer][5]).
|
||||||
|
|
||||||
|
In this article, I'll sidestep the debate about whether or not to use JSON as a configuration file format and explain how to parse this kind of information using the [Groovy programming language][6]. Groovy is based on Java but with a different set of design priorities that make Groovy feel more like Python.
|
||||||
|
|
||||||
|
### Install Groovy
|
||||||
|
|
||||||
|
Since Groovy is based on Java, it also requires a Java installation. You might find recent and decent versions of Java and Groovy in your Linux distribution's repositories. Or you can install Groovy following the [instructions][7] on its website. A nice alternative for Linux users is [SDKMan][8], which you can use to get multiple versions of Java, Groovy, and many other related tools. For this article, I'll use my distro's OpenJDK11 release and SDKMan's Groovy 3.0.7 release.
|
||||||
|
|
||||||
|
### The demo JSON configuration file
|
||||||
|
|
||||||
|
For this demonstration, I snagged this JSON from [Drupal][9]—it's the main configuration file used by the Drupal CMS—and saved it in the file `config.json`:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"vm": {
|
||||||
|
"ip": "192.168.44.44",
|
||||||
|
"memory": "1024",
|
||||||
|
"synced_folders": [
|
||||||
|
{
|
||||||
|
"host_path": "data/",
|
||||||
|
"guest_path": "/var/www",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"forwarded_ports": []
|
||||||
|
},
|
||||||
|
"vdd": {
|
||||||
|
"sites": {
|
||||||
|
"drupal8": {
|
||||||
|
"account_name": "root",
|
||||||
|
"account_pass": "root",
|
||||||
|
"account_mail": "[box@example.com][10]",
|
||||||
|
"site_name": "Drupal 8",
|
||||||
|
"site_mail": "[box@example.com][10]",
|
||||||
|
"vhost": {
|
||||||
|
"document_root": "drupal8",
|
||||||
|
"url": "drupal8.dev",
|
||||||
|
"alias": ["www.drupal8.dev"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"drupal7": {
|
||||||
|
"account_name": "root",
|
||||||
|
"account_pass": "root",
|
||||||
|
"account_mail": "[box@example.com][10]",
|
||||||
|
"site_name": "Drupal 7",
|
||||||
|
"site_mail": "[box@example.com][10]",
|
||||||
|
"vhost": {
|
||||||
|
"document_root": "drupal7",
|
||||||
|
"url": "drupal7.dev",
|
||||||
|
"alias": ["www.drupal7.dev"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a nice, complex JSON file with several levels of structure, like:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`<>.vdd.sites.drupal8.account_name`
|
||||||
|
```
|
||||||
|
|
||||||
|
and some lists like:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`<>.vm.synced_folders`
|
||||||
|
```
|
||||||
|
|
||||||
|
Here, `<>` represents the unnamed top level. Let's see how Groovy handles that.
|
||||||
|
|
||||||
|
### Parsing JSON with Groovy
|
||||||
|
|
||||||
|
Groovy comes with the `groovy.json` package, which is full of all sorts of cool stuff. One of the best parts is the `JsonSlurper` class, which includes several `parse()` methods that convert JSON to a Groovy `Map`—a data structure with values stored against keys.
|
||||||
|
|
||||||
|
Here's a nice, short Groovy program named `config1.groovy` that creates a `JsonSlurper` instance, then calls one of its `parse()` methods to parse the JSON in a file and convert it to a `Map` instance called `config`, and finally writes out that map:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
|
|
||||||
|
def jsonSlurper = new JsonSlurper()
|
||||||
|
|
||||||
|
def config = jsonSlurper.parse(new File('config.json'))
|
||||||
|
|
||||||
|
println "config = $config"
|
||||||
|
```
|
||||||
|
|
||||||
|
Run this program on the command line in a terminal:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy config1.groovy
|
||||||
|
config = [vm:[ip:192.168.44.44, memory:1024, synced_folders:[[host_path:data/, guest_path:/var/www, type:default]], forwarded_ports:[]], vdd:[sites:[drupal8:[account_name:root, account_pass:root, account_mail:[box@example.com][10], site_name:Drupal 8, site_mail:[box@example.com][10], vhost:[document_root:drupal8, url:drupal8.dev, alias:[www.drupal8.dev]]], drupal7:[account_name:root, account_pass:root, account_mail:[box@example.com][10], site_name:Drupal 7, site_mail:[box@example.com][10], vhost:[document_root:drupal7, url:drupal7.dev, alias:[www.drupal7.dev]]]]]]
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
The output shows a top-level map with two keys: `vm` and `vdd`. Each key references its own map of values. Notice the empty list referenced by the `forwarded_ports` key.
|
||||||
|
|
||||||
|
Huh. That was easy, but all it did was print things out. How do you get at the various components? Here's another program that shows how to access the value stored at `config.vm.ip`:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
|
|
||||||
|
def jsonSlurper = new JsonSlurper()
|
||||||
|
|
||||||
|
def config = jsonSlurper.parse(new File('config.json'))
|
||||||
|
|
||||||
|
println "config.vm.ip = ${config.vm.ip}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Run it:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy config2.groovy
|
||||||
|
config.vm.ip = 192.168.44.44
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
Yup, that's easy, too. This takes advantage of Groovy shorthand that means:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`config.vm.ip`
|
||||||
|
```
|
||||||
|
|
||||||
|
in Groovy is equivalent to:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`config['vm']['ip']`
|
||||||
|
```
|
||||||
|
|
||||||
|
when `config` and `config.vm` are both instances of `Map`, and both are equivalent to:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`config.get("vm").get("ip")`
|
||||||
|
```
|
||||||
|
|
||||||
|
in Java.
|
||||||
|
|
||||||
|
So much for just handling the JSON. What if you want to have a standard configuration and let the user override it? In that case, you might want to have a JSON configuration hard-coded in the program, then read the user configuration and override any of the standard configuration settings.
|
||||||
|
|
||||||
|
Say the above configuration is standard, and the user wants to override only a bit of it, just the `ip` and `memory` values in the `vm` structure, and put that in the `userConfig.json` file:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"vm": {
|
||||||
|
"ip": "201.201.201.201",
|
||||||
|
"memory": "4096",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You could do that using this program:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
|
|
||||||
|
def jsonSlurper = new JsonSlurper()
|
||||||
|
|
||||||
|
// use parseText() to parse a string rather than reading from a file
|
||||||
|
// this gives us the “standard configuration”
|
||||||
|
|
||||||
|
def standardConfig = jsonSlurper.parseText("""
|
||||||
|
{
|
||||||
|
"vm": {
|
||||||
|
"ip": "192.168.44.44",
|
||||||
|
"memory": "1024",
|
||||||
|
"synced_folders": [
|
||||||
|
{
|
||||||
|
"host_path": "data/",
|
||||||
|
"guest_path": "/var/www",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"forwarded_ports": []
|
||||||
|
},
|
||||||
|
"vdd": {
|
||||||
|
"sites": {
|
||||||
|
"drupal8": {
|
||||||
|
"account_name": "root",
|
||||||
|
"account_pass": "root",
|
||||||
|
"account_mail": "[box@example.com][10]",
|
||||||
|
"site_name": "Drupal 8",
|
||||||
|
"site_mail": "[box@example.com][10]",
|
||||||
|
"vhost": {
|
||||||
|
"document_root": "drupal8",
|
||||||
|
"url": "drupal8.dev",
|
||||||
|
"alias": ["www.drupal8.dev"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"drupal7": {
|
||||||
|
"account_name": "root",
|
||||||
|
"account_pass": "root",
|
||||||
|
"account_mail": "[box@example.com][10]",
|
||||||
|
"site_name": "Drupal 7",
|
||||||
|
"site_mail": "[box@example.com][10]",
|
||||||
|
"vhost": {
|
||||||
|
"document_root": "drupal7",
|
||||||
|
"url": "drupal7.dev",
|
||||||
|
"alias": ["www.drupal7.dev"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
// print out the standard configuration
|
||||||
|
|
||||||
|
println "standardConfig = $standardConfig"
|
||||||
|
|
||||||
|
// read in and parse the user configuration information
|
||||||
|
|
||||||
|
def userConfig = jsonSlurper.parse(new File('userConfig.json'))
|
||||||
|
|
||||||
|
// print out the user configuration information
|
||||||
|
|
||||||
|
println "userConfig = $userConfig"
|
||||||
|
|
||||||
|
// a function to merge the user configuration with the standard
|
||||||
|
|
||||||
|
def mergeMaps(Map input, Map merge) {
|
||||||
|
merge.each { k, v ->
|
||||||
|
if (v instanceof Map)
|
||||||
|
mergeMaps(input[k], v)
|
||||||
|
else
|
||||||
|
input[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// merge the configurations and print out the modified
|
||||||
|
// standard configuration
|
||||||
|
|
||||||
|
mergeMaps(standardConfig, userConfig)
|
||||||
|
|
||||||
|
println "modified standardConfig $standardConfig"
|
||||||
|
```
|
||||||
|
|
||||||
|
Run this as:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy config3.groovy
|
||||||
|
standardConfig = [vm:[ip:192.168.44.44, memory:1024, synced_folders:[[host_path:data/, guest_path:/var/www, type:default]], forwarded_ports:[]], vdd:[sites:[drupal8:[account_name:root, account_pass:root, account_mail:[box@example.com][10], site_name:Drupal 8, site_mail:[box@example.com][10], vhost:[document_root:drupal8, url:drupal8.dev, alias:[www.drupal8.dev]]], drupal7:[account_name:root, account_pass:root, account_mail:[box@example.com][10], site_name:Drupal 7, site_mail:[box@example.com][10], vhost:[document_root:drupal7, url:drupal7.dev, alias:[www.drupal7.dev]]]]]]
|
||||||
|
userConfig = [vm:[ip:201.201.201.201, memory:4096]]
|
||||||
|
modified standardConfig [vm:[ip:201.201.201.201, memory:4096, synced_folders:[[host_path:data/, guest_path:/var/www, type:default]], forwarded_ports:[]], vdd:[sites:[drupal8:[account_name:root, account_pass:root, account_mail:[box@example.com][10], site_name:Drupal 8, site_mail:[box@example.com][10], vhost:[document_root:drupal8, url:drupal8.dev, alias:[www.drupal8.dev]]], drupal7:[account_name:root, account_pass:root, account_mail:[box@example.com][10], site_name:Drupal 7, site_mail:[box@example.com][10], vhost:[document_root:drupal7, url:drupal7.dev, alias:[www.drupal7.dev]]]]]]
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
The line beginning `modified standardConfig` shows that the `vm.ip` and `vm.memory` values were overridden.
|
||||||
|
|
||||||
|
Sharp-eyed readers will notice that I did not check for malformed JSON , nor was I careful to ensure that the user configuration makes sense (doesn't create new fields, provides reasonable values, and so on). So the cute little recursive method to merge the two maps probably isn't all that practical in the real world.
|
||||||
|
|
||||||
|
Well I had to leave _something_ for homework, didn't I?
|
||||||
|
|
||||||
|
### Groovy resources
|
||||||
|
|
||||||
|
The Apache Groovy site has a lot of great [documentation][11]. Another great Groovy resource is [Mr. Haki][12]. And a really great reason to learn Groovy is to go on and learn [Grails][13], which is a wonderfully productive full-stack web framework built on top of excellent components like Hibernate, Spring Boot, and Micronaut.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/6/groovy-parse-json
|
||||||
|
|
||||||
|
作者:[Chris Hermansen][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/clhermansen
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/look-binoculars-sight-see-review.png?itok=NOw2cm39 (Looking back with binoculars)
|
||||||
|
[2]: https://www.libreoffice.org/discover/writer/
|
||||||
|
[3]: https://gitlab.gnome.org/GNOME/tracker
|
||||||
|
[4]: https://www.lucidchart.com/techblog/2018/07/16/why-json-isnt-a-good-configuration-language/
|
||||||
|
[5]: https://medium.com/trabe/stop-using-json-config-files-ab9bc55d82fa
|
||||||
|
[6]: https://groovy-lang.org/
|
||||||
|
[7]: https://groovy.apache.org/download.html
|
||||||
|
[8]: https://sdkman.io/
|
||||||
|
[9]: https://www.drupal.org/node/2008800
|
||||||
|
[10]: mailto:box@example.com
|
||||||
|
[11]: http://groovy-lang.org/documentation.html
|
||||||
|
[12]: https://blog.mrhaki.com/
|
||||||
|
[13]: https://grails.org/
|
@ -0,0 +1,212 @@
|
|||||||
|
[#]: subject: (How I build my personal website using containers with a Makefile)
|
||||||
|
[#]: via: (https://opensource.com/article/21/7/manage-containers-makefile)
|
||||||
|
[#]: author: (Chris Collins https://opensource.com/users/clcollins)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
How I build my personal website using containers with a Makefile
|
||||||
|
======
|
||||||
|
Simplify container management by combining the commands to build, test,
|
||||||
|
and deploy a project in a Makefile.
|
||||||
|
![Parts, modules, containers for software][1]
|
||||||
|
|
||||||
|
The `make` utility and its related [Makefile][2] have been used to build software for a long time. The Makefile defines a set of commands to run, and the `make` utility runs them. It is similar to a Dockerfile or Containerfile—a set of commands used to build container images.
|
||||||
|
|
||||||
|
Together, a Makefile and Containerfile are an excellent way to manage a container-based project. The Containerfile describes the contents of the container image, and the Makefile describes how to manage the project itself: kicking the image build, testing, and deployment, among other helpful commands.
|
||||||
|
|
||||||
|
### Make targets
|
||||||
|
|
||||||
|
The Makefile consists of "targets": one or more commands grouped under a single command. You can run each target by running the `make` command followed by the target you want to run:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
# Runs the "build_image" make target from the Makefile
|
||||||
|
$ make build_image
|
||||||
|
```
|
||||||
|
|
||||||
|
This is the beauty of the Makefile. You can build a collection of targets for each task that needs to be performed manually. In the context of a container-based project, this includes building the image, pushing it to a registry, testing the image, and even deploying the image and updating the service running it. I use a Makefile for my personal website to do all these tasks in an easy, automated way.
|
||||||
|
|
||||||
|
### Build, test, deploy
|
||||||
|
|
||||||
|
I build my website using [Hugo][3], a static website generator that builds static HTML from YAML files. I use Hugo to build the HTML files for me, then build a container image with those files and [Caddy][4], a fast and simple web server, and run that image as a container. (Both Hugo and Caddy are open source, Apache-licensed projects.) I use a Makefile to make building and deploying that image to production much easier.
|
||||||
|
|
||||||
|
The first target in the Makefile is appropriately the `image_build` command:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
image_build:
|
||||||
|
podman build --format docker -f Containerfile -t $(IMAGE_REF):$(HASH) .
|
||||||
|
```
|
||||||
|
|
||||||
|
This target invokes [Podman][5] to build an image from the Containerfile included in the project. There are some variables in the command above—what are they? Variables can be specified in the Makefile, similarly to Bash or a programming language. I use them for a variety of things within the Makefile, but the most useful is building the image reference to be pushed to remote container image registries:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
# Image values
|
||||||
|
REGISTRY := "us.gcr.io"
|
||||||
|
PROJECT := "my-project-name"
|
||||||
|
IMAGE := "some-image-name"
|
||||||
|
IMAGE_REF := $(REGISTRY)/$(PROJECT)/$(IMAGE)
|
||||||
|
|
||||||
|
# Git commit hash
|
||||||
|
HASH := $(shell git rev-parse --short HEAD)
|
||||||
|
```
|
||||||
|
|
||||||
|
Using these variables, the `image_build` target builds an image reference like `us.gcr.io/my-project-name/my-image-name:abc1234` using the short Git revision hash as the image tag so that it can be tied to the code that built it easily.
|
||||||
|
|
||||||
|
The Makefile then tags that image as `:latest`. I don't generally use `:latest` for anything in production, but further down in this Makefile, it will come in useful for cleanup:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
image_tag:
|
||||||
|
podman tag $(IMAGE_REF):$(HASH) $(IMAGE_REF):latest
|
||||||
|
```
|
||||||
|
|
||||||
|
So, now the image has been built and needs to be validated to make sure it meets some minimum requirements. For my personal website, this is honestly just, "does the webserver start and return something?" This could be accomplished with shell commands in the Makefile, but it was easier for me to write a Python script that starts a container with Podman, issues an HTTP request to the container, verifies it receives a reply, and then cleans up the container. Python's "try, except, finally" exception handling is perfect for this and considerably easier than replicating the same logic from shell commands in a Makefile:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import time
|
||||||
|
import argparse
|
||||||
|
from subprocess import check_call, CalledProcessError
|
||||||
|
from urllib.request import urlopen, Request
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('-i', '--image', action='store', required=True, help='image name')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
print(args.image)
|
||||||
|
|
||||||
|
try:
|
||||||
|
check_call("podman rm smk".split())
|
||||||
|
except CalledProcessError as err:
|
||||||
|
pass
|
||||||
|
|
||||||
|
check_call(
|
||||||
|
"podman run --rm --name=smk -p 8080:8080 -d {}".format(args.image).split()
|
||||||
|
)
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
r = Request("<http://localhost:8080>", headers={'Host': 'chris.collins.is'})
|
||||||
|
try:
|
||||||
|
print(str(urlopen(r).read()))
|
||||||
|
finally:
|
||||||
|
check_call("podman kill smk".split())
|
||||||
|
```
|
||||||
|
|
||||||
|
This could be a more thorough test. For example, during the build process, the Git revision hash could be built into the response, and the test could check that the response included the expected hash. This would have the benefit of verifying that at least some of the expected content is there.
|
||||||
|
|
||||||
|
If all goes well with the tests, then the image is ready to be deployed. I use Google's Cloud Run service to host my website, and like any of the major cloud services, there is an excellent command-line interface (CLI) tool that I can use to interact with the service. Since Cloud Run is a container service, deployment consists of pushing the images built locally to a remote container registry, and then kicking off a rollout of the service using the `gcloud` CLI tool.
|
||||||
|
|
||||||
|
You can do the push using Podman or Skopeo (or Docker, if you're using it). My push target pushes the `$(IMAGE_REF):$(HASH)` image and also the `:latest` tag:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
push:
|
||||||
|
podman push --remove-signatures $(IMAGE_REF):$(HASH)
|
||||||
|
podman push --remove-signatures $(IMAGE_REF):latest
|
||||||
|
```
|
||||||
|
|
||||||
|
After the image has been pushed, use the `gcloud run deploy` command to roll out the newest image to the project and make the new image live. Once again, the Makefile comes in handy here. I can specify the `--platform` and `--region` arguments as variables in the Makefile so that I don't have to remember them each time. Let's be honest: I write so infrequently for my personal blog, there is zero chance I would remember these variables if I had to type them from memory each time I deployed a new image:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
rollout:
|
||||||
|
gcloud run deploy $(PROJECT) --image $(IMAGE_REF):$(HASH) --platform $(PLATFORM) --region $(REGION)
|
||||||
|
```
|
||||||
|
|
||||||
|
### More targets
|
||||||
|
|
||||||
|
There are additional helpful `make` targets. When writing new stuff or testing CSS or code changes, I like to see what I'm working on locally without deploying it to a remote server. For this, my Makefile has a `run_local` command, which spins up a container with the contents of my current commit and opens my browser to the URL of the page hosted by the locally running webserver:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
.PHONY: run_local
|
||||||
|
run_local:
|
||||||
|
podman stop mansmk ; podman rm mansmk ; podman run --name=mansmk --rm -p $(HOST_ADDR):$(HOST_PORT):$(TARGET_PORT) -d $(IMAGE_REF):$(HASH) && $(BROWSER) $(HOST_URL):$(HOST_PORT)
|
||||||
|
```
|
||||||
|
|
||||||
|
I also use a variable for the browser name, so I can test with several if I want to. By default, it will open in Firefox when I run `make run_local`. If I want to test the same thing in Google, I run `make run_local BROWSER="google-chrome"`.
|
||||||
|
|
||||||
|
When working with containers and container images, cleaning up old containers and images is an annoying chore, especially when you iterate frequently. I include targets in my Makefile for handling these tasks, too. When cleaning up a container, if the container doesn't exist, Podman or Docker will return with an exit code of 125. Unfortunately, `make` expects each command to return 0 or it will stop processing, so I use a wrapper script to handle that case:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ID="${@}"
|
||||||
|
|
||||||
|
podman stop ${ID} 2>/dev/null
|
||||||
|
|
||||||
|
if [[ $? == 125 ]]
|
||||||
|
then
|
||||||
|
# No such container
|
||||||
|
exit 0
|
||||||
|
elif [[ $? == 0 ]]
|
||||||
|
then
|
||||||
|
podman rm ${ID} 2>/dev/null
|
||||||
|
else
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
Cleaning images requires a bit more logic, but it can all be done within the Makefile. To do this easily, I add a label (via the Containerfile) to the image when it's being built. This makes it easy to find all the images with these labels. The most recent of these images can be identified by looking for the `:latest` tag. Finally, all of the images, except those pointing to the image tagged with `:latest`, can be deleted:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
clean_images:
|
||||||
|
$(eval LATEST_IMAGES := $(shell podman images --filter "label=my-project.purpose=app-image" --no-trunc | awk '/latest/ {print $$3}'))
|
||||||
|
podman images --filter "label=my-project.purpose=app-image" --no-trunc --quiet | grep -v $(LATEST_IMAGES) | xargs --no-run-if-empty --max-lines=1 podman image rm
|
||||||
|
```
|
||||||
|
|
||||||
|
This is the point where using a Makefile for managing container projects really comes together into something cool. To this point, the Makefile includes commands for building and tagging images, testing, pushing images, rolling out a new version, cleaning up a container, cleaning up images, and running a local version. Running each of these with `make image_build && make image_tag && make test`… etc. is considerably easier than running each of the original commands, but it can be simplified even further.
|
||||||
|
|
||||||
|
A Makefile can group commands into a target, allowing multiple targets to run with a single command. For example, my Makefile groups the `image_build` and `image_tag` targets under the `build` target, so I can run both by simply using `make build`. Even better, these targets can be further grouped into the default `make` target, `all`, allowing me to run all of them in order by executing `make all` or more simply, `make`.
|
||||||
|
|
||||||
|
For my project, I want the default `make` action to include everything from building the image to testing, deploying, and cleaning up, so I include the following targets:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
.PHONY: all
|
||||||
|
all: build test deploy clean
|
||||||
|
|
||||||
|
.PHONY: build image_build image_tag
|
||||||
|
build: image_build image_tag
|
||||||
|
|
||||||
|
.PHONY: deploy push rollout
|
||||||
|
deploy: push rollout
|
||||||
|
|
||||||
|
.PHONY: clean clean_containers clean_images
|
||||||
|
clean: clean_containers clean_images
|
||||||
|
```
|
||||||
|
|
||||||
|
This does everything I've talked about in this article, except the `make run_local` target, in a single command: `make`.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
A Makefile is an excellent way to manage a container-based project. By combining all the commands necessary to build, test, and deploy a project into `make` targets within the Makefile, all the "meta" work—everything aside from writing the code—can be simplified and automated. The Makefile can even be used for code-related tasks: running unit tests, maintaining modules, compiling binaries and checksums. While it can't yet write code for you, using a Makefile combined with the benefits of a containerized, cloud-based service can `make` (wink, wink) managing many aspects of a project much easier.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/7/manage-containers-makefile
|
||||||
|
|
||||||
|
作者:[Chris Collins][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/clcollins
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software)
|
||||||
|
[2]: https://opensource.com/article/18/8/what-how-makefile
|
||||||
|
[3]: https://gohugo.io/
|
||||||
|
[4]: https://caddyserver.com/
|
||||||
|
[5]: https://podman.io
|
@ -0,0 +1,98 @@
|
|||||||
|
[#]: subject: (Try Dolibarr, an open source customer relationship management platform)
|
||||||
|
[#]: via: (https://opensource.com/article/21/7/open-source-dolibarr)
|
||||||
|
[#]: author: (Pradeep Vijayakumar https://opensource.com/users/deepschennai)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Try Dolibarr, an open source customer relationship management platform
|
||||||
|
======
|
||||||
|
Maintain a customer database and send promotions and offers with
|
||||||
|
Dolibarr's CRM features.
|
||||||
|
![a handshake ][1]
|
||||||
|
|
||||||
|
No matter what industry you work in, a key aspect of sustaining your business is keeping your customers. In the customer-relations domain, we call this _customer retention_.
|
||||||
|
|
||||||
|
Whether you run a retail store, restaurant, pub, supermarket, gym, or any other business, you need a reliable way to keep in touch with your customers. After all, they're customers because they like what you do, and, if they've shared their contact information with you, they want to hear more about what you have to offer. Sending them discount coupons, promotions, and special offers benefits your customers and helps ensure they remember your brand and come back to do business with you again.
|
||||||
|
|
||||||
|
So, how can you achieve this?
|
||||||
|
|
||||||
|
I work with [many other people][2] on the [Dolibarr][3] project. It's an open source enterprise resource planning (ERP) and customer relationship management (CRM) software. Dolibarr provides a whole range of ERP features, including point-of-sale (POS), invoicing, stock and inventory management, sales orders, purchase orders, and human resources management. This article focuses on Dolibarr's CRM features, which help you maintain a database of your customers and connect with them to send promotions and offers.
|
||||||
|
|
||||||
|
Even if you've never used a CRM system before, Dolibarr makes it easy to manage your customers and, as long as you put in the effort, enhance customer loyalty.
|
||||||
|
|
||||||
|
### Install Dolibarr CRM
|
||||||
|
|
||||||
|
Dolibarr is open source, so you can [download][4] it and run it locally. If your store's staff includes more than a few people, you probably need a few networked Dolibarr instances. Your systems administrator can set that up for you or, if you're on your own, many hosting service providers offer one-click installers, such as Installatron and Softaculous.
|
||||||
|
|
||||||
|
In the interim, you can try Dolibarr's [online demo][5].
|
||||||
|
|
||||||
|
### Add customer data
|
||||||
|
|
||||||
|
The first step to getting to know your customers is getting your customers' information into your CRM system. You may not have this data yet, so you'll be starting fresh, or you might have a database or spreadsheet from a system that hasn't been working out for you. Dolibarr imports a wide variety of formats, so it's relatively painless to migrate.
|
||||||
|
|
||||||
|
For the sake of simplicity, I'll assume you're entering new customers. To enter a new customer into your Dolibarr system, navigate to the **Third-parties** menu, and click on the **New Customer** menu item.
|
||||||
|
|
||||||
|
![add a new customer to Dolibarr][6]
|
||||||
|
|
||||||
|
(Pradeep Vijayakumar, [CC BY-SA 4.0][7])
|
||||||
|
|
||||||
|
All the fields are configurable, and you can add and remove fields if you want. Define a marketing strategy on how you want to connect with your customers. It could be email, SMS, Facebook, Twitter, or another way your customers prefer. Once you have defined the communication channel, you know what information you need to capture for each customer.
|
||||||
|
|
||||||
|
For example, if you've chosen email as your communication method, you know to ask your customers for an email address so that you can put it into the system, along with their name, location, and any other information that may be important to you.
|
||||||
|
|
||||||
|
### Set up an email campaign
|
||||||
|
|
||||||
|
Imagine you're running a weekend promotion with a 20% discount on selected products. Here's how to run an email campaign to announce this offer to all your customers in just a few clicks.
|
||||||
|
|
||||||
|
First, click on the **Tools** tab and the **New Emailing** link. You can use the editor's WYSIWYG capabilities to design attractive emails.
|
||||||
|
|
||||||
|
![Drafting a marketing email with Dolibarr's WYSIWYG Editor][8]
|
||||||
|
|
||||||
|
(Pradeep Vijayakumar, [CC BY-SA 4.0][7])
|
||||||
|
|
||||||
|
You can use substitution variables to individualize your customers' name, location, gender, etc., as long as you have captured this information in the system (use the **?** tool tip to get the list of substitution variables). Because this email will go out to all the people in your database, you must use the substitution variables to represent any customer-specific data, such as your customers' names.
|
||||||
|
|
||||||
|
Once you've drafted your email, the next step is choosing your customer list. Navigate to the **Recipients** tab and choose **Third parties (by categories)**.
|
||||||
|
|
||||||
|
![Add customers to an email campaign list][9]
|
||||||
|
|
||||||
|
(Pradeep Vijayakumar, [CC BY-SA 4.0][7])
|
||||||
|
|
||||||
|
All your customers should be included in this email list; you can confirm this by looking at the count displayed next to the list and under **Number of distinct recipients**.
|
||||||
|
|
||||||
|
You can now click on **Validate** and then **Send** to send your email to all of your customers. Dolibarr automatically substitutes the substitution variables with actual customer data. You can also view the delivery reports for the emails that were sent out.
|
||||||
|
|
||||||
|
### Integrations
|
||||||
|
|
||||||
|
Because the marketplace is ever-changing, CRM software needs to keep pace with what customers use for communication. Dolibarr is designed for integration. You can, for instance, manage SMS marketing the same way you manage email marketing. The same is true for WhatsApp and many other targets.
|
||||||
|
|
||||||
|
### Learn more
|
||||||
|
|
||||||
|
All things considered, I think Dolibarr is an indispensable tool for implementing a customer relationship and customer retention strategy for your business. You can learn more about Dolibarr's CRM features by watching [this video on YouTube][10].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/7/open-source-dolibarr
|
||||||
|
|
||||||
|
作者:[Pradeep Vijayakumar][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/deepschennai
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/handshake_business_contract_partner.png?itok=NrAWzIDM (a handshake )
|
||||||
|
[2]: https://www.dolibarr.org/who-works-on-the-dolibarr-project-.php
|
||||||
|
[3]: http://dolibarr.org/
|
||||||
|
[4]: https://www.dolibarr.org/downloads.php
|
||||||
|
[5]: https://www.dolibarr.org/onlinedemo.php
|
||||||
|
[6]: https://opensource.com/sites/default/files/uploads/dolibarr_add-customer.png (add a new customer to Dolibarr)
|
||||||
|
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[8]: https://opensource.com/sites/default/files/uploads/dolibarr_create-email.png (Drafting a marketing email with Dolibarr's WYSIWYG Editor)
|
||||||
|
[9]: https://opensource.com/sites/default/files/uploads/dolibarr_select-recipients.png (Add customers to an email campaign list)
|
||||||
|
[10]: https://youtu.be/9ETxdpVsgU0
|
@ -0,0 +1,271 @@
|
|||||||
|
[#]: subject: (Creating a PKGBUILD to Make Packages for Arch Linux)
|
||||||
|
[#]: via: (https://itsfoss.com/create-pkgbuild/)
|
||||||
|
[#]: author: (Hunter Wittenborn https://itsfoss.com/author/hunter/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Creating a PKGBUILD to Make Packages for Arch Linux
|
||||||
|
======
|
||||||
|
|
||||||
|
PKGBUILD files are how packages are built and created for Arch Linux and its derivatives such as Manjaro.
|
||||||
|
|
||||||
|
You may have even come across them a bit yourself if you’ve ever used the [AUR][1], Arch Linux’s user-curated repository of PKGBUILDs.
|
||||||
|
|
||||||
|
But how exactly do you go from a PKGBUILD to an installable package? What exactly is going on between the two, and how can you make them for your own packages? You’ll learn them in this article.
|
||||||
|
|
||||||
|
### PKGBUILD basics
|
||||||
|
|
||||||
|
For those who are familiar with Bash or other shells, you’ll be delighted to know, if you didn’t already, that a PKGBUILD is pretty much just a shell script with some variables.
|
||||||
|
|
||||||
|
PKGBUILD files consist of variables and functions, all of which are used to define the package itself, and how to build it.
|
||||||
|
|
||||||
|
To create a package from a PKGBUILD, the makepkg command line utility is used. After obtaining a PKGBUILD, you simply run `makepkg` inside the directory containing the PKGBUILD, and voila, you have an installable package!
|
||||||
|
|
||||||
|
![][2]
|
||||||
|
|
||||||
|
In this tutorial, you’ll be going over the package I just made, which prints “Hello World!” when run:
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
### Getting set up
|
||||||
|
|
||||||
|
To follow along with this tutorial, you need to create a couple of files.
|
||||||
|
|
||||||
|
First, you need to make a file called **PKGBUILD**. If it wasn’t already made clear, this will serve as the “recipe” for building your package.
|
||||||
|
|
||||||
|
The other file you’ll need to make is a file called **hello-world.sh**. I’ll explain its purpose a bit later.
|
||||||
|
|
||||||
|
You can create both of these files with a single command as well.
|
||||||
|
|
||||||
|
```
|
||||||
|
touch PKGBUILD hello-world.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
You can check that the files were created with the ls command:
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
And you’re ready to go!
|
||||||
|
|
||||||
|
### Setting up your PKGBUILD file
|
||||||
|
|
||||||
|
**Instead of having you copy paste the whole file, I’ll be going over entering every line with you, so you can better understand the purpose of everything that’s happening. If you don’t prefer to learn this way, I’d highly recommend the** [Arch Wiki article][5] _**on creating packages for Arch Linux.**_
|
||||||
|
|
||||||
|
_**This article also doesn’t go over every single option you can set in a PKGBUILD, but rather some commonly used ones so you can get going as quickly as possible.**_
|
||||||
|
|
||||||
|
With that out of the way, open up your text editor, and let’s get straight into it!
|
||||||
|
|
||||||
|
#### pkgname
|
||||||
|
|
||||||
|
First things first, the pkgname variable. This is what defines the name of your package when installing, and how [Arch Linux’s package manager pacman][6] keeps track of the package.
|
||||||
|
|
||||||
|
The format of this variable (and some others) takes the form of variable=value, with the variable name on the left, the value of the variable on the right, separated by an equals sign.
|
||||||
|
|
||||||
|
To set the package name, enter the following into the PKGBUILD:
|
||||||
|
|
||||||
|
```
|
||||||
|
pkgname="hello-world"
|
||||||
|
```
|
||||||
|
|
||||||
|
* To set a different package name, replace `hello-world` with the name of the package.
|
||||||
|
* This doesn’t set the command used to run the program. That’s handled a bit below in the `package()` section.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### pkgver
|
||||||
|
|
||||||
|
As is stated in the variable name itself, this sets the version of your package (i.e. 1.0.0). This is useful when a user updates their system, as setting a higher version will result in the user being prompted for an upgrade.
|
||||||
|
|
||||||
|
To set, enter the following into the PKGBUILD (after the previous line):
|
||||||
|
|
||||||
|
```
|
||||||
|
pkgver="1.0.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### pkgrel
|
||||||
|
|
||||||
|
This is related to the pkgver variable, and isn’t normally important to know about. Like the pkgver variable though, it will notify users for upgrades if it’s moved to a higher number.
|
||||||
|
|
||||||
|
It serves for any changes that require the pkgver to remain the same, such as any changes to the PKGBUILD itself. This would be useful if you’ve created a PKGBUILD for a program you use (and want to keep the version the same as the package’s), and you need to fix a bug in the PKGBUILD itself.
|
||||||
|
|
||||||
|
To set the variable, enter the following in the PKGBUILD:
|
||||||
|
|
||||||
|
```
|
||||||
|
pkgver="1"
|
||||||
|
```
|
||||||
|
|
||||||
|
This variable should **always** start at 1, and then move up one at a time. When the **pkgver** itself moves up, this can (and should) be reset to 1, as the pkgver itself will notify users that upgrades are available.
|
||||||
|
|
||||||
|
#### pkgdesc
|
||||||
|
|
||||||
|
This will set the description of the package, which is used to help better identify the package.
|
||||||
|
|
||||||
|
To set it, just put the description inside of quotation marks:
|
||||||
|
|
||||||
|
```
|
||||||
|
pkgdesc="Hello world in your terminal!"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### arch
|
||||||
|
|
||||||
|
This variable sets the [architecture][7] the package is compatible with. It’s fine if you don’t understand what an architecture is, as it’s pretty much useless in most cases.
|
||||||
|
|
||||||
|
Regardless, makepkg still needs it to be set so it knows the package is compatible with our system.
|
||||||
|
|
||||||
|
This variable supports setting multiple values, so makepkg requires a different syntax as shown below.
|
||||||
|
|
||||||
|
To set it, enter the following in the PKGBUILD:
|
||||||
|
|
||||||
|
```
|
||||||
|
arch=("x86_64")
|
||||||
|
```
|
||||||
|
|
||||||
|
If you were to set multiple values for this, you would separate each value with a space and quotation marks like so: **arch=(“x86_x64” “arm”)**
|
||||||
|
|
||||||
|
#### depends
|
||||||
|
|
||||||
|
This lists all of the packages that our package needs to function. Like **arch**, it can also contain multiple values, and thus must use the parenthesis syntax.
|
||||||
|
|
||||||
|
Since our package won’t have any dependencies, we don’t have to enter this field in the PKGBUILD. If our package did have dependencies however, we’d just use the same syntax as **arch**.
|
||||||
|
|
||||||
|
#### optdepends
|
||||||
|
|
||||||
|
This lists packages that aren’t required to function, but that are needed for extra functionality.
|
||||||
|
|
||||||
|
This follows the same syntax as **depends**.
|
||||||
|
|
||||||
|
#### conflicts
|
||||||
|
|
||||||
|
This tells pacman what packages would cause our package to act up or behave in a way we wouldn’t want.
|
||||||
|
|
||||||
|
Any package listed here would be uninstalled before ours is installed.
|
||||||
|
|
||||||
|
This follows the same syntax as **depends** as well.
|
||||||
|
|
||||||
|
#### license
|
||||||
|
|
||||||
|
This defines the [software license][8] that your program is licensed under. The [Arch Wiki][9] has some info if you need help choosing a license. Setting this to `custom` will work if you don’t know what to set this to.
|
||||||
|
|
||||||
|
This takes the same syntax as **arch** and **depends**:
|
||||||
|
|
||||||
|
```
|
||||||
|
license=("custom")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### source
|
||||||
|
|
||||||
|
This is how makepkg knows what files to use to build our package. This can contain a variety of different kinds of sources, including local files and URLs.
|
||||||
|
|
||||||
|
When adding local files, enter the file’s name relative to the PKGBUILD i.e. consider the following directory layout:
|
||||||
|
|
||||||
|
```
|
||||||
|
PKGBUILD
|
||||||
|
file.txt
|
||||||
|
src/file.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
If you wanted to include **file.sh** in our PKGBUILD, you would enter **src/file.sh** as its name.
|
||||||
|
|
||||||
|
When entering URLs, you simply enter the full URL, i.e. <https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png>.
|
||||||
|
|
||||||
|
Your package only needs the hello-world.sh file, and since it’s in the same directory as the PKGBUILD, you just type its name as the value for **source**.
|
||||||
|
|
||||||
|
This variable also uses the same syntax as **arch** and **depends**:
|
||||||
|
|
||||||
|
```
|
||||||
|
source=("hello-world.sh")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### sha512sums
|
||||||
|
|
||||||
|
This is used to verify that the files in **source** haven’t been modified or downloaded incorrectly. Information on obtaining the values for this can be found in the [Arch Wiki article on PKGBUILDs][10].
|
||||||
|
|
||||||
|
If you’d rather just not set this (or you just don’t need to, i.e. for local files), you can just enter SKIP for every file in the **source** variable:
|
||||||
|
|
||||||
|
```
|
||||||
|
sha512sums=("SKIP")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### package()
|
||||||
|
|
||||||
|
This is the last, and most important part to actually making our package. It’s important to know two variables when working with this:
|
||||||
|
|
||||||
|
* **${srcdir}**: This is where makepkg puts the files in the **source** variable. This is the directory where you can interact with the files, and do any other needed modification to the files.
|
||||||
|
|
||||||
|
|
||||||
|
* ${pkgdir}: This is where we place the files that will be installed on our system.
|
||||||
|
The folder structure for ${pkgdir} is set up as if it was on an actual system (i.e. ${pkgdir}/usr/bin/hello-world would create the file /usr/bin/hello-world when installing with pacman.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package() contains a list of commands used create a package.
|
||||||
|
|
||||||
|
So, if (hypothetically) you needed to have a file that reads Linux is superior to Windows at /usr/share/motto.txt, you would run something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
package() {
|
||||||
|
mkdir -p "${pkgdir}/usr/share"
|
||||||
|
echo "Linux is superior to Windows" | tee "${pkgdir}/usr/share/motto.txt"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A few notes on the above command:
|
||||||
|
|
||||||
|
* ${pkgdir} contains **no** directories inside it at first. If you skipped the [mkdir command][11], tee would output an error saying the directory doesn’t exist.
|
||||||
|
|
||||||
|
|
||||||
|
* When specifying directories, **always** prepend them with the **${pkgdir}** or **${srcdir}** variable. Entering something like /usr/share/motto.txt without such would point to the literal directory /usr/share/motto.txt on your currently running system.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For your PKGBUILD, you’re going to place the file hello-world.sh at /usr/bin/hello-world on your target system. You’ll also be making the file say “Hello to you!” when ran.
|
||||||
|
|
||||||
|
To do so, enter the following into your PKGBUILD:
|
||||||
|
|
||||||
|
```
|
||||||
|
package() {
|
||||||
|
echo 'Hello to you!' > "${srcdir}/hello-world.sh"
|
||||||
|
mkdir -p "${pkgdir}/usr/bin"
|
||||||
|
cp "${srcdir}/hello-world.sh" "${pkgdir}/usr/bin/hello-world"
|
||||||
|
chmod +x "${pkgdir}/usr/bin/hello-world"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And you’re done! **Build and install the package with makepkg -si**, and then run hello-world in your terminal to see its output.
|
||||||
|
|
||||||
|
![][12]
|
||||||
|
|
||||||
|
### Wrapping Up
|
||||||
|
|
||||||
|
And just like that, you have made your first PKGBUILD! You’re on your way to making actual packages for yourself, and maybe even the AUR.
|
||||||
|
|
||||||
|
Got any questions, or something just not working right? Feel free to post it in the comment section below.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/create-pkgbuild/
|
||||||
|
|
||||||
|
作者:[Hunter Wittenborn][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/hunter/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/aur-arch-linux/
|
||||||
|
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/image.png?resize=748%2C689&ssl=1
|
||||||
|
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/image-2.png?resize=682%2C260&ssl=1
|
||||||
|
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/05/image-3.png?resize=682%2C265&ssl=1
|
||||||
|
[5]: https://wiki.archlinux.org/title/Creating_packages
|
||||||
|
[6]: https://itsfoss.com/pacman-command/
|
||||||
|
[7]: https://www.quora.com/What-is-CPU-architecture
|
||||||
|
[8]: https://en.wikipedia.org/wiki/Software_license
|
||||||
|
[9]: https://wiki.archlinux.org/title/PKGBUILD#license
|
||||||
|
[10]: https://wiki.archlinux.org/title/PKGBUILD#Integrity
|
||||||
|
[11]: https://linuxhandbook.com/mkdir-command/
|
||||||
|
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/image-1.png?resize=561%2C281&ssl=1
|
@ -1,225 +0,0 @@
|
|||||||
[#]: subject: (Use open source tools to set up a private VPN)
|
|
||||||
[#]: via: (https://opensource.com/article/21/5/open-source-private-vpn)
|
|
||||||
[#]: author: (Lukas Janėnas https://opensource.com/users/lukasjan)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (stevenzdg988)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
使用开源工具创建私有 VPN
|
|
||||||
======
|
|
||||||
使用 OpenWRT 和 Wireguard 在路由器上创建自己的虚拟专用网络。
|
|
||||||
![拼写为 “VPN”][1]
|
|
||||||
|
|
||||||
通过计算机网络从一个地方到另一个地方可能是一件棘手的事情。除了知道正确的地址和打开正确的端口之外,还有安全问题。 对于 Linux,SSH 是一种流行的默认设置,虽然您可以使用 SSH 做很多事情,但它仍然“只是”一个安全外壳(实际上,这就是 SSH 代表的)。用于加密流量的更广泛的协议是 VPN,它创建了一个独特的两点之间的虚拟专用网络。有了它,您可以登录到另一个网络上的计算机并使用它的所有服务(文件共享、打印机,等等),就像您坐在同一个房间里一样,并且全部的数据都是从点到点加密的。
|
|
||||||
|
|
||||||
通常,为了使 VPN 连接成为可能,进入每个网络的网关必须接受 VPN 流量,并且必须侦听目标网络上的某些计算机的 VPN 流量。但是,可以运行您自己的运行 VPN 服务器的路由器固件,使您能够连接到目标网络,而无需担心转发端口或完全考虑内部拓扑。我最喜欢的固件是 OpenWrt,在本文中我将演示如何设置它,以及如何启用 VPN。
|
|
||||||
|
|
||||||
### 什么是 OpenWrt?
|
|
||||||
|
|
||||||
[OpenWrt][2] 是一个使用 Linux 面向嵌入式设备的开源项目。它已经存在超过 15 年,拥有庞大而活跃的社区。
|
|
||||||
|
|
||||||
使用 OpenWrt 的方法有很多种,但它的主要用途是在路由器中。它提供了一个具有包管理功能的完全可写的文件系统,并且由于它是开源的,您可以查看和修改代码并为生态系统做出贡献。如果您想对路由器进行更多控制,这就是您想要使用的系统。
|
|
||||||
|
|
||||||
OpenWrt 支持很多路由器,包括 [Cisco][3],[ASUS][4],[MikroTik][5],[Teltonika Networks][6],[D-Link][7],[TP-link][8],[Buffalo][9],[Ubiquiti][10] 等知名品牌和 [许多其他品牌][11]。
|
|
||||||
|
|
||||||
### Wireguard 是什么?
|
|
||||||
|
|
||||||
[Wireguard][12] 是开源虚拟专用网络 (VPN) 软件,它比 OpenVPN 等其他选项更快、更简单且更安全。它使用最先进的密码学:ChaCha20 用于对称密码学;用于密钥协商的曲线 25519(使用椭圆曲线);和用于散列的 BLAKE2 。这些算法的设计方式在嵌入式系统上是高效的。WIreguard 也可用于各种操作系统[平台][13]。
|
|
||||||
|
|
||||||
### 先决条件
|
|
||||||
|
|
||||||
对于这个项目,你需要:
|
|
||||||
|
|
||||||
* [Teltonika RUT955][14] 或支持 OpenWrt 的其他路由器
|
|
||||||
* 用于从外部网络连接到 VPN 的公网 IP 地址
|
|
||||||
* 一部安卓手机
|
|
||||||
|
|
||||||
### 安装 OpenWrt
|
|
||||||
|
|
||||||
首先,下载路由器的 OpenWrt 镜像。使用[固件选择器][15]检查 OpenWrt 是否支持您的路由器并下载固件。输入您的路由器型号,将显示选项:
|
|
||||||
|
|
||||||
![OpenWRT 固件选择器][16]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
使用搜索框右侧的下拉输入选择要下载的固件版本。
|
|
||||||
|
|
||||||
下载出厂镜像。
|
|
||||||
|
|
||||||
![下载出厂镜像][18]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
许多路由器允许您从 Web 界面刷入未经授权的固件,但 Teltonika Networks 不允许。要将 OpenWrt 固件刷入这样的路由器,您需要使用引导加载程序。为此,请按照下列步骤操作:
|
|
||||||
|
|
||||||
1. 拔掉路由器的电源线。
|
|
||||||
2. 按住重置按钮。
|
|
||||||
3. 插入路由器的电源线。
|
|
||||||
4. 插入电源线后,继续按住重置按钮 5 到 8 秒。
|
|
||||||
5. 将计算机的 IP 地址设置为 `192.168.1.15`,将网络掩码设置为 `255.255.255.0`。
|
|
||||||
6. 使用以太网电缆通过 LAN 端口连接路由器和计算机。
|
|
||||||
7. 打开网页浏览器并输入`192.168.1.1:/index.html`。
|
|
||||||
8. 上传并刷写固件。
|
|
||||||
|
|
||||||
刷机过程可能占用三分钟。之后,您应该可以通过在浏览器中输入 `192.168.1.1` 来访问路由器的 Web 界面。 默认情况下没有设置密码
|
|
||||||
|
|
||||||
![OpenWrt 授权][19]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
### 配置网络连接
|
|
||||||
|
|
||||||
网络连接是必要条件。如果您的 Internet 服务提供商 (ISP) 使用 DHCP 自动分配您的 IP 地址,您只需将以太网电缆插入路由器的 WAN 端口。
|
|
||||||
|
|
||||||
如果您需要手动分配 IP 地址,导航至 **Network → Interfaces**。选择 **Edit** 编辑您的 WAN 接口。从 **Protocol** 字段中,选择 **Static address**,然后选择 **Switch protocol**。
|
|
||||||
|
|
||||||
![手动分配 IP 地址][20]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
在 **IPv4 address** 字段中,输入您的路由器地址。设置 **IPv4 netmask** 以匹配您的网络子网;输入您将用于连接到网络的 **IPv4 gateway** 地址; 并在 **Use custom DNS servers** 字段中输入 DNS 服务器的地址。保存配置。
|
|
||||||
|
|
||||||
就是这样!您已成功配置 WAN 接口以获得网络连接。
|
|
||||||
|
|
||||||
### 安装必要的包
|
|
||||||
|
|
||||||
默认情况下,固件不包含很多包,但 OpenWrt 有一个选择可安装的包管理器。导航到 **System → Software** 并通过选择 **Update list...** 更新您的包管理器。
|
|
||||||
|
|
||||||
![OpenWrt 包管理器][21]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
在过滤器输入中,键入 **Wireguard**,等待系统找到所有包含该关键字的包。找到并安装名为 **luci-app-wireguard** 的包。
|
|
||||||
|
|
||||||
![luci-app-wireguard 包][22]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
该软件包包括一个用于配置 Wireguard 的 Web 界面,并安装 Wireguard 所必需的所有依赖项。
|
|
||||||
|
|
||||||
如果您在安装 Wireguard 软件包之前收到一个软件包丢失的警告并且在存储库中找不到,请忽略它并继续。
|
|
||||||
|
|
||||||
接下来,找到并安装名为 **luci-app-ttyd** 的包。这将用于稍后访问终端。
|
|
||||||
|
|
||||||
安装这些软件包后,重新启动路由器以使更改生效。
|
|
||||||
|
|
||||||
### 配置 Wireguard 接口
|
|
||||||
|
|
||||||
接下来,创建 Wireguard 接口。导航到 **Network → Interfaces** 并选择左下角的 **Add new interface...**。在弹出窗口中,输入您想要的接口名称,从下拉列表中选择 **Wireguard VPN**,然后选择右下角的 **Create interface**。
|
|
||||||
|
|
||||||
![创建 Wireguard 接口][23]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
在新弹出的窗口中,选择 **Generate Key** 为 Wireguard 接口生成私钥。在 **Listen Port** 字段中,输入所需的端口。我将使用默认的 Wireguard 端口,**51820**。在 **IP Addresses** 字段中,分配将用于 Wireguard 接口的 IP 地址。在这个例子中,我使用了 `10.0.0.1/24`。数字 **24** 表明我的子网的大小。
|
|
||||||
|
|
||||||
![创建 Wireguard 接口][24]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
保存配置并重启接口。
|
|
||||||
|
|
||||||
导航到 **Services → Terminal**,登录到 shell,然后输入命令 `wg show`。您将看到有关 Wiregaurd 接口的一些信息,包括其公钥。复制公钥——稍后您将需要它来创建对等点。
|
|
||||||
|
|
||||||
![Wireguard 公钥][25]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
### 配置防火墙
|
|
||||||
|
|
||||||
导航到 **Network → Firewall** 并选择 **Traffic Rules** 选项卡。在页面底部,选择 **Add**。在弹出窗口的 **Name** 字段中,为您的规则命名,例如 **Allow-wg**。接下来,将 **Destination zone** 从 **Lan** 更改为 **Device**,并将 **Destination port** 设置为 51820。
|
|
||||||
|
|
||||||
![Wireguard 防火墙设置][26]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
保存配置。
|
|
||||||
|
|
||||||
### 手机上配置 Wireguard
|
|
||||||
|
|
||||||
从 Google Play 在您的手机上安装 [Wireguard 应用程序][27]。安装后,打开应用程序并从头开始创建一个新接口。在 **Name** 字段中,输入要用于接口的名称。在 **Private key** 字段中,按右侧的双箭头图标生成密钥对。您将需要上面的公钥来在您的手机和路由器之间创建一个对等点。在 **Addresses** 字段中,分配您将用于通过 VPN 访问电话的 IP 地址。我将使用 `10.0.0.2/24`。在 **Listen port**中,输入端口;我将再次使用默认端口。
|
|
||||||
|
|
||||||
![在 Android 上设置 VPN 接口][28]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
保存配置。
|
|
||||||
|
|
||||||
要向配置中添加对等点,请选择 **Add peer**。在 **Public key** 字段中,输入路由器的 Wireguard 公钥。在 **Endpoint** 字段中,输入路由器的公共 IP 地址和端口,以冒号分隔,例如 `12.34.56.78:51820`。在 **Allowed IP** 字段中,输入要通过 Wireguard 接口访问的 IP 地址。 (您可以输入路由器的 VPN 接口 IP 地址和 LAN 接口地址。)IP 地址必须用逗号分隔。您还可以定义子网的大小。
|
|
||||||
|
|
||||||
![在 Android 上添加 VPN 对等点][29]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
保存配置。
|
|
||||||
|
|
||||||
配置中还剩下最后一步:在路由器上添加一个对等点。
|
|
||||||
|
|
||||||
### 在路由器上添加一个对等点
|
|
||||||
|
|
||||||
导航到 **Network → Interfaces** 并选择您的 Wireguard 接口。转到 **Peers** 选项卡并选择 **Add peer**。 在 **Description** 字段中,输入对等方的名称。在 **Public Key** 字段中输入手机的 Wireguard 接口公钥,在 **Allowed IPs** 字段中输入手机的 Wireguard 接口 IP 地址。选中 **Route Allowed IPs** 复选框。
|
|
||||||
|
|
||||||
![在路由器上添加一个对等点][30]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
保存配置并重启接口。
|
|
||||||
|
|
||||||
### 测试配置
|
|
||||||
|
|
||||||
在手机上打开网络浏览器。在 URL 栏中,输入 IP 地址 `10.0.0.1` 或 `192.168.1.1`。您应该能够访问路由器的网站。
|
|
||||||
|
|
||||||
![从 Android 登录 VPN][31]
|
|
||||||
|
|
||||||
(Lukas Janenas, [CC BY-SA 4.0][17])
|
|
||||||
|
|
||||||
### 您自己的 VPN
|
|
||||||
|
|
||||||
这些天有很多 VPN 服务商在做广告,但是拥有和控制自己的基础设施还有很多话要说,尤其是当该基础设施仅用于提高安全性时。无需依赖其他人为您提供安全的数据连接。使用 OpenWrt 和 Wireguard,您可以拥有自己的开源 VPN 解决方案。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/5/open-source-private-vpn
|
|
||||||
|
|
||||||
作者:[Lukas Janėnas][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[stevenzdg988](https://github.com/stevenzdg988)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/lukasjan
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/vpn_scrabble_networking.jpg?itok=pdsUHw5N (scrabble letters used to spell "VPN")
|
|
||||||
[2]: https://openwrt.org/
|
|
||||||
[3]: https://www.cisco.com/c/en/us/products/routers/index.html
|
|
||||||
[4]: https://www.asus.com/Networking-IoT-Servers/WiFi-Routers/All-series/
|
|
||||||
[5]: https://mikrotik.com/
|
|
||||||
[6]: https://teltonika-networks.com/
|
|
||||||
[7]: https://www.dlink.com/en/consumer
|
|
||||||
[8]: https://www.tp-link.com/us/
|
|
||||||
[9]: https://www.buffalotech.com/products/category/wireless-networking
|
|
||||||
[10]: https://www.ui.com/
|
|
||||||
[11]: https://openwrt.org/toh/views/toh_fwdownload
|
|
||||||
[12]: https://www.wireguard.com/
|
|
||||||
[13]: https://www.wireguard.com/install/
|
|
||||||
[14]: https://teltonika-networks.com/product/rut955/
|
|
||||||
[15]: https://firmware-selector.openwrt.org/
|
|
||||||
[16]: https://opensource.com/sites/default/files/uploads/openwrt_firmware-selector.png (OpenWRT firmware selector)
|
|
||||||
[17]: https://creativecommons.org/licenses/by-sa/4.0/
|
|
||||||
[18]: https://opensource.com/sites/default/files/uploads/downloadfactoryimage.png (Downloading the Factory Image)
|
|
||||||
[19]: https://opensource.com/sites/default/files/uploads/openwrt_authorization.png (OpenWrt authorization)
|
|
||||||
[20]: https://opensource.com/sites/default/files/uploads/openwrt_staticaddress.png (Assigning IP address manually)
|
|
||||||
[21]: https://opensource.com/sites/default/files/uploads/openwrt_update-lists.png (OpenWrt package manager)
|
|
||||||
[22]: https://opensource.com/sites/default/files/uploads/wireguard-package.png (luci-app-wireguard package)
|
|
||||||
[23]: https://opensource.com/sites/default/files/uploads/wireguard_createinterface.png (Creating Wireguard interface)
|
|
||||||
[24]: https://opensource.com/sites/default/files/uploads/wireguard_createinterface2.png (Creating Wireguard interface)
|
|
||||||
[25]: https://opensource.com/sites/default/files/uploads/wireguard_publickey.png (Wireguard public key)
|
|
||||||
[26]: https://opensource.com/sites/default/files/uploads/wireguard-firewallsetup.png (Wireguard firewall setup)
|
|
||||||
[27]: https://play.google.com/store/apps/details?id=com.wireguard.android&hl=lt&gl=US
|
|
||||||
[28]: https://opensource.com/sites/default/files/uploads/vpn_inferfacesetup.png (Setting up VPN interface on Android)
|
|
||||||
[29]: https://opensource.com/sites/default/files/uploads/addpeeronphone.png (Adding a VPN peer on an Android)
|
|
||||||
[30]: https://opensource.com/sites/default/files/uploads/addpeeronrouter.png (Adding a peer on the router)
|
|
||||||
[31]: https://opensource.com/sites/default/files/uploads/android-vpn-login.png (Logging into the VPN from Android)
|
|
127
translated/tech/20210624 Copy files between Linux and FreeDOS.md
Normal file
127
translated/tech/20210624 Copy files between Linux and FreeDOS.md
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
[#]: subject: (Copy files between Linux and FreeDOS)
|
||||||
|
[#]: via: (https://opensource.com/article/21/6/copy-files-linux-freedos)
|
||||||
|
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (geekpi)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
在 Linux 和 FreeDOS 之间复制文件
|
||||||
|
======
|
||||||
|
下面是我如何在我的 FreeDOS 虚拟机和 Linux 桌面系统之间传输文件。
|
||||||
|
![Files in a folder][1]
|
||||||
|
|
||||||
|
我运行 Linux 作为我的主要操作系统,我在一个虚拟机中启动 FreeDOS。大多数时候,我使用 QEMU 作为我的 PC 模拟器,但有时我会用 GNOME Boxes(它使用 QEMU 作为后端虚拟机)或用 VirtualBox 运行其他实验。
|
||||||
|
|
||||||
|
我喜欢玩经典的 DOS 游戏,有时我也会调出一个最喜欢的 DOS 应用。我在管理信息系统 (MIS) 课上讲计算机的历史,有时我会用 FreeDOS 和一个传统的 DOS 应用录制一个演示,比如 As-Easy-As(我最喜欢的 DOS 电子表格,曾经作为“共享软件”发布,但现在可以[从 TRIUS 公司免费获得)][2])。
|
||||||
|
|
||||||
|
但是以这种方式使用 FreeDOS 意味着我需要在我的 FreeDOS 虚拟机和我的 Linux桌 面系统之间传输文件。让我来展示是如何做到这一点的。
|
||||||
|
|
||||||
|
### 用 guestmount 访问镜像
|
||||||
|
|
||||||
|
我曾经通过计算第一个 DOS 分区的偏移量来访问我的虚拟磁盘镜像,然后用正确的选项组合来调用 Linux 的 `mount` 命令来匹配这个偏移量。这总是很容易出错,而且不是很灵活。幸运的是,有一个更简单的方法可以做到这一点。来自 [libguestfs-tools][3] 包的 `guestmount` 程序可以让你从 Linux 中访问或_挂载_虚拟磁盘镜像。你可以在 Fedora 上用这个命令安装 `libguestfs-tools`:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ yum install libguestfs-tools libguestfs`
|
||||||
|
```
|
||||||
|
|
||||||
|
使用 `guestmount` 并不像从 GNOME 文件管理器中双击文件那么简单,但命令行的使用并不难。`guestmount` 的基本用法是:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ guestmount -a image -m device mountpoint`
|
||||||
|
```
|
||||||
|
|
||||||
|
在这个用法中,_image_ 是要使用的虚拟磁盘镜像。在我的系统中,我用 `qemu-img` 命令创建了 QEMU 虚拟磁盘镜像。`guestmount` 程序可以读取这种磁盘镜像格式,以及 GNOME Boxes 使用的 QCOW2 镜像格式,或者 VirtualBox 使用的 VDI 镜像格式。
|
||||||
|
|
||||||
|
_device_ 选项表示虚拟磁盘上的分区。想象一下,把这个虚拟磁盘当作一个真正的硬盘使用。你可以用 `/dev/sda1` 访问第一个分区,用 `/dev/sda2` 访问第二个分区,以此类推。这就是 `guestmount` 的语法。默认情况下,FreeDOS 1.3 RC4 在一个空的驱动器上创建了一个分区,所以访问这个分区的时候要用 `/dev/sda1`。
|
||||||
|
|
||||||
|
而 _mountpoint_ 是在你的本地 Linux 系统上“挂载” DOS 文件系统的位置。我通常会创建一个临时目录来工作。你只在访问虚拟磁盘时需要挂载点。
|
||||||
|
|
||||||
|
综上所述,我使用这组命令从 Linux 访问我的 FreeDOS 虚拟磁盘镜像:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkdir /tmp/freedos
|
||||||
|
$ guestmount -a freedos.img -m /dev/sda1 /tmp/freedos
|
||||||
|
```
|
||||||
|
|
||||||
|
之后,我可以通过 `/tmp/freedos` 目录访问我的 FreeDOS 文件,使用 Linux 上的普通工具。我可以在命令行中使用 `ls /tmp/freedos`,或者使用桌面文件管理器打开 `/tmp/freedos` 挂载点。
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ls -l /tmp/freedos
|
||||||
|
total 216
|
||||||
|
drwxr-xr-x. 5 root root 8192 May 10 15:53 APPS
|
||||||
|
-rwxr-xr-x. 1 root root 85048 Apr 30 07:54 COMMAND.COM
|
||||||
|
-rwxr-xr-x. 1 root root 103 May 13 15:48 CONFIG.SYS
|
||||||
|
drwxr-xr-x. 5 root root 8192 May 15 16:52 DEVEL
|
||||||
|
drwxr-xr-x. 2 root root 8192 May 15 13:36 EDLIN
|
||||||
|
-rwxr-xr-x. 1 root root 1821 May 10 15:57 FDAUTO.BAT
|
||||||
|
-rwxr-xr-x. 1 root root 740 May 13 15:47 FDCONFIG.SYS
|
||||||
|
drwxr-xr-x. 10 root root 8192 May 10 15:49 FDOS
|
||||||
|
-rwxr-xr-x. 1 root root 46685 Apr 30 07:54 KERNEL.SYS
|
||||||
|
drwxr-xr-x. 2 root root 8192 May 10 15:57 SRC
|
||||||
|
-rwxr-xr-x. 1 root root 3190 May 16 08:34 SRC.ZIP
|
||||||
|
drwxr-xr-x. 3 root root 8192 May 11 18:33 TEMP
|
||||||
|
```
|
||||||
|
|
||||||
|
![GNOME file manager][4]
|
||||||
|
|
||||||
|
使用 GNOME 文件管理器来访问虚拟磁盘
|
||||||
|
(Jim Hall, [CC-BY SA 4.0][5])
|
||||||
|
|
||||||
|
例如,要从我的 Linux `projects` 目录中复制几个 C 源文件到虚拟磁盘镜像上的 `C:\SRC`,以便我以后能在 FreeDOS 下使用这些文件,我可以使用 Linux `cp` 命令:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ cp /home/jhall/projects/*.c /tmp/freedos/SRC`
|
||||||
|
```
|
||||||
|
|
||||||
|
虚拟驱动器上的文件和目录在技术上是不分大小写的,所以你可以用大写或小写字母来引用它们。然而,我发现使用所有大写字母来输入 DOS 文件和目录更为自然。
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ls /tmp/freedos
|
||||||
|
APPS CONFIG.SYS EDLIN FDCONFIG.SYS KERNEL.SYS SRC.ZIP
|
||||||
|
COMMAND.COM DEVEL FDAUTO.BAT FDOS SRC TEMP
|
||||||
|
|
||||||
|
$ ls /tmp/freedos/EDLIN
|
||||||
|
EDLIN.EXE MAKEFILE.OW
|
||||||
|
|
||||||
|
$ ls /tmp/freedos/edlin
|
||||||
|
EDLIN.EXE MAKEFILE.OW
|
||||||
|
```
|
||||||
|
|
||||||
|
### 用 guestmount 卸载
|
||||||
|
|
||||||
|
在你再次在虚拟机中使用虚拟磁盘镜像之前,你应该总是先_卸载_。如果你在运行 QEMU 或 VirtualBox 时让镜像挂载,你有可能弄乱你的文件。
|
||||||
|
|
||||||
|
与 `guestmount` 配套的命令是 `guestunmount`,用来卸载磁盘镜像。只要给出你想卸载的挂载点就可以了:
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ guestunmount /tmp/freedos`
|
||||||
|
```
|
||||||
|
|
||||||
|
请注意命令拼写与 Linux 的 `umount` 稍有不同。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/6/copy-files-linux-freedos
|
||||||
|
|
||||||
|
作者:[Jim Hall][a]
|
||||||
|
选题:[lujun9972][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/jim-hall
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder)
|
||||||
|
[2]: http://www.triusinc.com/forums/viewtopic.php?t=10
|
||||||
|
[3]: https://libguestfs.org/
|
||||||
|
[4]: https://opensource.com/sites/default/files/uploads/gnome-file-manager.png (Using GNOME file manager to access the virtual disk)
|
||||||
|
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
@ -0,0 +1,139 @@
|
|||||||
|
[#]: subject: (Forgot Linux Password on WSL? Here’s How to Reset it Easily)
|
||||||
|
[#]: via: (https://itsfoss.com/reset-linux-password-wsl/)
|
||||||
|
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (geekpi)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
在 WSL 上忘记了 Linux 密码?下面是如何轻松重设的方法
|
||||||
|
======
|
||||||
|
|
||||||
|
对于那些想从舒适的 Windows 中享受 Linux 命令行的人来说,WSL(Windows Subsystem for Linux) 是一个方便的工具。
|
||||||
|
|
||||||
|
当你[在 Windows 上使用 WSL 安装 Linux][1]时,会要求你创建一个用户名和密码。当你在 WSL 上启动 Linux 时,这个用户会自动登录。
|
||||||
|
|
||||||
|
现在的问题是,如果你有一段时间没有使用它,你可能会忘记 WSL 的账户密码。而如果你要使用 sudo 的命令,这将成为一个问题,因为这里你需要输入密码。
|
||||||
|
|
||||||
|
![][2]
|
||||||
|
|
||||||
|
不要担心。你可以很容易地重置它。
|
||||||
|
|
||||||
|
### 在 Ubuntu 或任何其他 Linux 发行版上重置遗忘的 WSL 密码
|
||||||
|
|
||||||
|
要在 WSL 中重设 Linux 密码,你需要:
|
||||||
|
|
||||||
|
* 将默认用户切换为 root
|
||||||
|
* 重置普通用户的密码
|
||||||
|
* 将默认用户切换回正常用户
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
让我向你展示详细的步骤和截图。
|
||||||
|
|
||||||
|
#### 步骤 1:将默认用户切换为 root
|
||||||
|
|
||||||
|
记下你的普通/常规用户名将是明智之举。如你所见,我的普通帐户的用户名是 abhishek。
|
||||||
|
|
||||||
|
![Note down the account username][3]
|
||||||
|
|
||||||
|
WSL 中的 root 用户是解锁的,没有设置密码。这意味着你可以切换到 root 用户,然后利用 root 的能力来重置密码。
|
||||||
|
|
||||||
|
由于你不记得帐户密码,切换到根用户是通过改变你的 Linux WSL 应用的配置,使其默认使用 root 用户来完成。
|
||||||
|
|
||||||
|
这是通过 Windows 命令提示符完成的,你需要知道你的 Linux 发行版需要运行哪个命令。
|
||||||
|
|
||||||
|
这个信息通常在 [Windows Store][4] 中的发行版应用的描述中提供。这是你首次下载发行版的地方。
|
||||||
|
|
||||||
|
![Know the command to run for your distribution app][5]
|
||||||
|
|
||||||
|
从 Windows 菜单中,启动命令提示符:
|
||||||
|
|
||||||
|
![Start Command Prompt][6]
|
||||||
|
|
||||||
|
在这里,以这种方式使用你的发行版的命令。如果你使用的是 Windows 商店中的 Ubuntu 应用,那么该命令将是:
|
||||||
|
|
||||||
|
```
|
||||||
|
ubuntu config --default-user root
|
||||||
|
```
|
||||||
|
|
||||||
|
截图中,我正在使用 Windows 商店中的 Ubuntu 20.04 应用。所以,我使用了 ubuntu2004 命令。
|
||||||
|
|
||||||
|
![Set root as default user in Linux app’s configuration][7]
|
||||||
|
|
||||||
|
为了减少你的麻烦,我在这个表格中列出了一些发行版和它们各自的命令:
|
||||||
|
|
||||||
|
发行版应用 | Windows 命令
|
||||||
|
---|---
|
||||||
|
Ubuntu | ubuntu config –default-user root
|
||||||
|
Ubuntu 20.04 | ubuntu2004 config –default-user root
|
||||||
|
Ubuntu 18.04 | ubuntu1804 config –default-user root
|
||||||
|
Debian | debian config –default-user root
|
||||||
|
Kali Linux | kali config –default-user root
|
||||||
|
|
||||||
|
#### 步骤 2:重设帐户密码
|
||||||
|
|
||||||
|
现在,如果你启动 Linux 发行程序,你应该以 root 身份登录。你可以重新设置普通用户帐户的密码。
|
||||||
|
|
||||||
|
你还记得 WSL 中的用户名吗?如果没有,你可以随时检查 /home 目录的内容。当你有了用户名后,使用这个命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
passwd username
|
||||||
|
```
|
||||||
|
|
||||||
|
它将要求你输入一个新的密码。**当你输入时,屏幕上将不会显示任何内容。这很正常。只要输入新的密码,然后点击回车就可以了。**你必须重新输入新的密码来确认,当你输入密码时,屏幕上也不会显示任何东西。
|
||||||
|
|
||||||
|
![Reset the password for the regular user][8]
|
||||||
|
|
||||||
|
恭喜你。用户账户的密码已经被重置。但你还没有完成。默认用户仍然是 root。你应该把它改回你的普通用户帐户,否则它将一直以 root 用户的身份登录。
|
||||||
|
|
||||||
|
#### 步骤 3:再次将普通用户设置为默认用户
|
||||||
|
|
||||||
|
你需要你在上一步中用 [passwd 命令][9]使用的普通帐户用户名。
|
||||||
|
|
||||||
|
再次启动 Windows 命令提示符。**使用你的发行版命令**,方式与第 1 步中类似。然而,这一次,用普通用户代替 root。
|
||||||
|
|
||||||
|
```
|
||||||
|
ubuntu config --default-user username
|
||||||
|
```
|
||||||
|
|
||||||
|
![Set regular user as default user][10]
|
||||||
|
|
||||||
|
现在,当你在 WSL 中启动你的 Linux 发行版时,你将以普通用户的身份登录。你已经重新设置了密码,可以用它来运行 sudo 的命令。
|
||||||
|
|
||||||
|
如果你将来再次忘记了密码,你知道重置密码的步骤。
|
||||||
|
|
||||||
|
### 如果重设 WSL 密码如此简单,这难道不是一种安全风险吗?
|
||||||
|
|
||||||
|
并非如此。你需要有对计算机的物理访问权以及对 Windows 帐户的访问权。如果有人已经有这么多的访问权,他/她可以做很多事情,而不仅仅是改变 WSL 中的 Linux 密码。
|
||||||
|
|
||||||
|
### 你是否能够重新设置 WSL 密码?
|
||||||
|
|
||||||
|
我给了你命令并解释了步骤。我希望这对你有帮助,并能够在 WSL 中重置你的 Linux 发行版的密码。
|
||||||
|
|
||||||
|
如果你仍然遇到问题,或者你对这个话题有疑问,请随时在评论区提问。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/reset-linux-password-wsl/
|
||||||
|
|
||||||
|
作者:[Abhishek Prakash][a]
|
||||||
|
选题:[lujun9972][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/abhishek/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/install-bash-on-windows/
|
||||||
|
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/reset-wsl-password.png?resize=800%2C450&ssl=1
|
||||||
|
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/username-wsl.png?resize=800%2C296&ssl=1
|
||||||
|
[4]: https://www.microsoft.com/en-us/store/apps/windows
|
||||||
|
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/wsl-distro-command.png?resize=800%2C602&ssl=1
|
||||||
|
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/start-cmd-windows.jpg?resize=800%2C500&ssl=1
|
||||||
|
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/wsl-set-root-as-default.png?resize=800%2C288&ssl=1
|
||||||
|
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/resetting-wsl-password.png?resize=800%2C366&ssl=1
|
||||||
|
[9]: https://linuxhandbook.com/passwd-command/
|
||||||
|
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/set-regular-user-as-default-wsl.png?resize=800%2C288&ssl=1
|
@ -0,0 +1,88 @@
|
|||||||
|
[#]: subject: (Fotoxx: An Open Source App for Managing and Editing Large Photo Collection)
|
||||||
|
[#]: via: (https://itsfoss.com/fotoxx/)
|
||||||
|
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (geekpi)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Fotoxx:用于管理和编辑大型照片收藏的开源应用
|
||||||
|
======
|
||||||
|
|
||||||
|
说到 [Linux 中的照片管理软件][1],Shotwell 可能是其中最有名的。难怪它在许多发行版中都预装了。
|
||||||
|
|
||||||
|
但是,如果你正在寻找一个类似 Shotwell 的应用,而且速度更快,Fotoxx 可能是一个不错的选择。
|
||||||
|
|
||||||
|
它可能没有一个现代的用户界面,但它在处理大量照片收藏时速度很快。这一点很重要,因为索引和显示成千上万张照片的缩略图可能需要相当多的时间和计算资源。
|
||||||
|
|
||||||
|
### 用 Fotoxx 在 Linux 中管理照片并编辑它们
|
||||||
|
|
||||||
|
![Fotoxx interface][2]
|
||||||
|
|
||||||
|
正如你在上面的截图中看到的,它没有漂亮的界面。看起来更像是一个 2010 年左右的应用。它在视觉上的不足,在功能和性能上得到了弥补。
|
||||||
|
|
||||||
|
你可以导入大量的照片,包括 RAW 图像。这些图片保持原样。它们不会被复制或移动。它们只是在应用中被索引。
|
||||||
|
|
||||||
|
你可以编辑图像元数据,如标签、地理标签、日期、评级、标题等。你可以根据这些元数据来搜索图片。
|
||||||
|
|
||||||
|
它还有一个地图功能,可以分组并显示属于某个地点的图片(基于图片上的地理标签数据)。
|
||||||
|
|
||||||
|
![Map view][3]
|
||||||
|
|
||||||
|
由于它专注于管理大型照片集,它有几个批处理功能,可以重命名、调整大小、复制/移动、转换图像格式和编辑元数据。
|
||||||
|
|
||||||
|
你可以选择图片来创建相册和幻灯片,所有这些都是在去重图片的情况下进行的。照片可以组合成 360 度的全景图。
|
||||||
|
|
||||||
|
Fotoxx 还有几个编辑功能,可以用来修饰图片,添加效果(如素描,绘画)、修剪、旋转等。
|
||||||
|
|
||||||
|
还有一些选项可以去除旧的、扫描过的照片打印件上的红眼和尘斑。
|
||||||
|
|
||||||
|
我可以继续列举功能清单,但这没有结束。它的网站描述了它的全部功能,你应该去看看。
|
||||||
|
|
||||||
|
[Fotoxx Feature Overview][4]
|
||||||
|
|
||||||
|
如果你感兴趣,你可以观看这个演示 Fotoxx 功能的视频。
|
||||||
|
|
||||||
|
### 在 Linux 上安装 Fotoxx
|
||||||
|
|
||||||
|
请记住,**Fotoxx 的开发者建议使用一台强大的计算机**,有 4 个以上的 CPU 核心,16GB 以上的内存,以便正常运行。较小的计算机可能会很慢,或可能无法编辑大型图像。
|
||||||
|
|
||||||
|
Fotoxx 在大多数 Linux 发行版中都有,如 Debian、Ubuntu、Fedora 和 Arch Linux。只需使用你的发行版的包管理器或软件中心来搜索 Fotoxx 并安装它。
|
||||||
|
|
||||||
|
在基于 Ubuntu 和 Debian 的发行版上,你可以使用 apt 命令来安装它,像这样:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install fotoxx
|
||||||
|
```
|
||||||
|
|
||||||
|
当你第一次运行它时,它会要求搜索主目录中的图像。你可以继续使用它,或者将搜索位置限制在选定的文件夹。
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
我注意到,尽管在一分钟左右的时间内索引了 4700 多张,但它并没有立即开始显示图片。我不得不**点击 Gallery->All Folders,然后选择文件夹,然后它就显示了图片**。所以,这一点要记住。
|
||||||
|
|
||||||
|
Fotoxx 是一个功能广泛的工具,你需要一些时间来适应它并探索它的所有功能。它的网站列出了几个例子,你应该看看。
|
||||||
|
|
||||||
|
[Fotoxx Feature Examples][4]
|
||||||
|
|
||||||
|
正如我前面所说,它不是最漂亮的应用,但它大量的功能列表可以完成任务。如果你是一个摄影师或有大量的图片收藏,你可以试试 Fotoxx,看看它是否符合你的需要。当你试过后,请在评论区分享你的经验。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/fotoxx/
|
||||||
|
|
||||||
|
作者:[Abhishek Prakash][a]
|
||||||
|
选题:[lujun9972][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/abhishek/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/linux-photo-management-software/
|
||||||
|
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/06/fotoxx-interface.jpg?resize=800%2C561&ssl=1
|
||||||
|
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/fotoxx-geotag-map-view.jpg?resize=800%2C466&ssl=1
|
||||||
|
[4]: https://kornelix.net/fotoxx/fotoxx.html
|
||||||
|
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/fotoxx-indexing.png?resize=800%2C617&ssl=1
|
Loading…
Reference in New Issue
Block a user