mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-03 01:10:13 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
96744d4f00
@ -1,38 +1,40 @@
|
||||
如何在 Linux 上安装设备驱动程序
|
||||
======
|
||||
学习 Linux 设备驱动如何工作,并知道如何使用它们。
|
||||
|
||||
> 学习 Linux 设备驱动如何工作,并知道如何使用它们。
|
||||
|
||||

|
||||
|
||||
对于一个熟悉 Windows 或者 MacOS 的人,想要切换到 Linux,它们都会面临一个艰巨的问题就是怎么安装和配置设备驱动。这是可以理解的,因为 Windows 和 MacOS 都有一套机制把这个过程做得非常的友好。比如说,当你插入一个新的硬件设备, Windows 能够自动检测并会弹出一个窗口询问你是否要继续驱动程序。你也可以从网络上下载驱动程序,仅仅需要双击解压或者是通过设备管理器导入驱动程序即可。
|
||||
对于一个熟悉 Windows 或者 MacOS 的人,想要切换到 Linux,它们都会面临一个艰巨的问题就是怎么安装和配置设备驱动。这是可以理解的,因为 Windows 和 MacOS 都有一套机制把这个过程做得非常的友好。比如说,当你插入一个新的硬件设备, Windows 能够自动检测并会弹出一个窗口询问你是否要继续驱动程序的安装。你也可以从网络上下载驱动程序,仅仅需要双击解压或者是通过设备管理器导入驱动程序即可。
|
||||
|
||||
而这在 Linux 操作系统上并非这么简单。第一个原因是, Linux 是一个开源的操作系统,所以有 [数百种 Linux 发行版的变体][1]。也就是说不可能做一个指南来适应所有的 Linux 发行版。因为每种 Linux 安装驱动程序的过程都有差异。
|
||||
|
||||
第二,大多数默认的 Linux 驱动程序也都是开源的,并被集成到了系统中,这使得安装一些并未包含的驱动程序变得非常复杂,即使已经可以检测大多数的硬件设备。第三,不同发行版的许可也有差异。例如,[Fedora 禁止事项][2] 禁止包含专有的,受法律保护,或者是违反美国法律的驱动程序。而 Ubuntu 则让用户[避免使用受法律保护或闭源的硬件设备][3]。
|
||||
第二,大多数默认的 Linux 驱动程序也都是开源的,并被集成到了系统中,这使得安装一些并未包含的驱动程序变得非常复杂,即使已经可以检测大多数的硬件设备。第三,不同发行版的许可也有差异。例如,[Fedora 禁止事项][2] 禁止包含专有的、受法律保护,或者是违反美国法律的驱动程序。而 Ubuntu 则让用户[避免使用受法律保护或闭源的硬件设备][3]。
|
||||
|
||||
为了更好的学习 Linux 驱动程序是如何工作的,我建议阅读 Linux 设备驱动程序一书中的 [设备驱动程序简介][4]。
|
||||
为了更好的学习 Linux 驱动程序是如何工作的,我建议阅读 《Linux 设备驱动程序》一书中的 [设备驱动程序简介][4]。
|
||||
|
||||
### 两种方式来寻找驱动程序
|
||||
|
||||
#### 1\. 用户界面
|
||||
#### 1、 用户界面
|
||||
|
||||
如果是一个刚从 Windows 或 MacOS 转过来的 Linux 新手,那你会很高兴知道 Linux 也提供了一个通过向导式的程序来查看驱动程序是否可用的方法。 Ubuntu 提供了一个 [附加驱动程序][5] 选项。其它的 Linux 发行版也提供了帮助程序,像 [GNOME 的包管理器][6],你可以使用它来检查驱动程序是否可用。
|
||||
|
||||
#### 2\. 命令行
|
||||
#### 2、 命令行
|
||||
|
||||
如果你通过漂亮的用户界面找到驱动程序,那又该怎么办呢?或许你只能通过没有任何图形界面的 shell?甚至你可以使用控制台来展现你的技能。你有两个选择:
|
||||
如果你通过漂亮的用户界面没有找到驱动程序,那又该怎么办呢?或许你只能通过没有任何图形界面的 shell?甚至你可以使用控制台来展现你的技能。你有两个选择:
|
||||
|
||||
A. **通过一个仓库**
|
||||
这和 MacOS 中的 [**homebrew**][7] 命令行很像。通过使用 `yum` , `dnf` , `apt-get` , 等等。你基本可以通过添加仓库,并更新包缓存。
|
||||
1. **通过一个仓库**
|
||||
|
||||
B. **下载, 编译, 然后自己构建**
|
||||
这通常包括直接从网络,或通过 `wget` 命令下载源码包,然后运行配置和编译、安装。这超出了本文的范围,但是你可以在网络上找到很多在线指南,如果你选择的是这条路的话。
|
||||
这和 MacOS 中的 [homebrew][7] 命令行很像。通过使用 `yum`、 `dnf`、`apt-get` 等等。你基本可以通过添加仓库,并更新包缓存。
|
||||
2. **下载、编译,然后自己构建**
|
||||
|
||||
这通常包括直接从网络,或通过 `wget` 命令下载源码包,然后运行配置和编译、安装。这超出了本文的范围,但是你可以在网络上找到很多在线指南,如果你选择的是这条路的话。
|
||||
|
||||
### 检查是否已经安装了这个驱动程序
|
||||
|
||||
在进一步学习安装 Linux 驱动程序之前,让我们来学习几条命令,用来检测驱动程序是否已经在你的系统上可用。
|
||||
|
||||
[`lspci`][8] 命令显示了系统上所有 PCI 总线和设备驱动程序的详细信息。
|
||||
[lspci][8] 命令显示了系统上所有 PCI 总线和设备驱动程序的详细信息。
|
||||
|
||||
```
|
||||
$ lscpci
|
||||
@ -46,13 +48,13 @@ $ lscpci | grep SOME_DRIVER_KEYWORD
|
||||
|
||||
例如,你可以使用 `lspci | grep SAMSUNG` 命令,如果你想知道是否安装过三星的驱动。
|
||||
|
||||
[`dmesg`][9] 命令显示了所有内核识别的驱动程序。
|
||||
[dmesg][9] 命令显示了所有内核识别的驱动程序。
|
||||
|
||||
```
|
||||
$ dmesg
|
||||
```
|
||||
|
||||
或配合 `grep` 使用
|
||||
或配合 `grep` 使用:
|
||||
|
||||
```
|
||||
$ dmesg | grep SOME_DRIVER_KEYWORD
|
||||
@ -72,7 +74,7 @@ $ /sbin/lsmod
|
||||
$ find /lib/modules
|
||||
```
|
||||
|
||||
小贴士:和`lspci` 或 `dmesg` 一样,通过在上面的命令后面加上 `| grep` 来过滤结果。
|
||||
技巧:和 `lspci` 或 `dmesg` 一样,通过在上面的命令后面加上 `| grep` 来过滤结果。
|
||||
|
||||
如果一个驱动程序已经被识别到了,但是通过 `lscpi` 或 `dmesg` 并没有找到,这意味着驱动程序已经存在于硬盘上,但是并没有加载到内核中,这种情况,你可以通过 `modprobe` 命令来加载这个模块。
|
||||
|
||||
@ -84,9 +86,9 @@ $ sudo modprobe MODULE_NAME
|
||||
|
||||
### 添加仓库并安装
|
||||
|
||||
可以通过 `yum` , `dnf` , 和 `apt-get` 几种不同的方式来添加一个仓库;一个个介绍完它们并不在本文的范围。简单一点来说,这个示例将会使用 `apt-get` ,但是这个命令和其它的几个都是很类似的。
|
||||
可以通过 `yum`、`dnf` 和 `apt-get` 几种不同的方式来添加一个仓库;一个个介绍完它们并不在本文的范围。简单一点来说,这个示例将会使用 `apt-get` ,但是这个命令和其它的几个都是很类似的。
|
||||
|
||||
**1\. 删除存在的仓库,如果它存在.**
|
||||
#### 1、删除存在的仓库,如果它存在
|
||||
|
||||
```
|
||||
$ sudo apt-get purge NAME_OF_DRIVER*
|
||||
@ -94,7 +96,7 @@ $ sudo apt-get purge NAME_OF_DRIVER*
|
||||
|
||||
其中 `NAME_OF_DRIVER` 是你的驱动程序的可能的名称。你还可以将模式匹配加到正则表达式中来进一步过滤。
|
||||
|
||||
**2\. 将仓库加入到仓库表中,这应该在驱动程序指南中有指定**
|
||||
#### 2、将仓库加入到仓库表中,这应该在驱动程序指南中有指定
|
||||
|
||||
```
|
||||
$ sudo add-apt-repository REPOLIST_OF_DRIVER
|
||||
@ -102,23 +104,22 @@ $ sudo add-apt-repository REPOLIST_OF_DRIVER
|
||||
|
||||
其中 `REPOLIST_OF_DRIVER` 应该从驱动文档中有指定(例如:`epel-list`)。
|
||||
|
||||
**3\. 更新仓库列表。**
|
||||
#### 3、更新仓库列表
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
```
|
||||
|
||||
**4\. 安装驱动程序。**
|
||||
#### 4、安装驱动程序
|
||||
|
||||
```
|
||||
$ sudo apt-get install NAME_OF_DRIVER
|
||||
```
|
||||
|
||||
**5\. 检查安装状态.**
|
||||
#### 5、检查安装状态
|
||||
|
||||
像上面说的一样,通过 `lscpi` 命令来检查驱动程序是否已经安装成功。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/11/how-install-device-driver-linux
|
||||
@ -126,7 +127,7 @@ via: https://opensource.com/article/18/11/how-install-device-driver-linux
|
||||
作者:[Bryant Son][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Jamskr](https://github.com/Jamskr)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,58 @@
|
||||
[^#]: collector: lujun9972
|
||||
[^#]: translator:
|
||||
[^#]: reviewer:
|
||||
[^#]: publisher:
|
||||
[^#]: subject: 10 ways to give thanks to open source and free software maintainers
|
||||
[^#]: via: https://opensource.com/article/18/11/ways-give-thanks-open-source
|
||||
[^#]: author: [Moshe Zadka]( https://opensource.com/users/moshez)
|
||||
[^#]: url:
|
||||
|
||||
10 ways to give thanks to open source and free software maintainers
|
||||
======
|
||||
How to express your gratitude.
|
||||

|
||||
|
||||
Every day, I use high-quality software that is developed and maintained by people who do not ask for payment, who respect my freedoms, and who are generous with their time and energy.
|
||||
|
||||
In this season of giving thanks, I encourage those of you who also use and appreciate the work of open source and free software maintainers to express your gratitude. Here are ten ways to do that:
|
||||
|
||||
### Easy to do
|
||||
|
||||
1. Send an e-mail thanking the developers. Be specific—tell them what you are using their software for and how it has benefited you.
|
||||
2. Use your favorite social media platform to spread the word.
|
||||
3. Write a blog post about your favorite software.
|
||||
|
||||
|
||||
|
||||
### Give money
|
||||
|
||||
4. If your favorite open source projects accept donations, send money.
|
||||
5. If you are employed by a company that uses open source software, see if you can convince management to sponsor some of the projects.
|
||||
6. Offer to match donations up to a set amount. It is amazing what social motivation can do!
|
||||
|
||||
|
||||
|
||||
### Give time
|
||||
|
||||
7. Help review patches.
|
||||
8. Help triage bugs.
|
||||
9. Answer questions on IRC, mailing lists, or [Stack Overflow][1].
|
||||
|
||||
|
||||
|
||||
**10. Bonus:** If you are like me, you have at some point said harsh words to other people in the open source community. Commit to do better: Communicate with kindness and openness. The best way to give thanks is to make the open source community a place where people feel comfortable communicating.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/11/ways-give-thanks-open-source
|
||||
|
||||
作者:[Moshe Zadka][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/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://meta.stackoverflow.com/
|
@ -0,0 +1,124 @@
|
||||
[^#]: collector: lujun9972
|
||||
[^#]: translator:
|
||||
[^#]: reviewer:
|
||||
[^#]: publisher:
|
||||
[^#]: subject: A Closer Look at Voice-Assisted Speakers
|
||||
[^#]: via: https://www.linux.com/blog/2018/11/closer-look-voice-assisted-speakers
|
||||
[^#]: author: [Eric Brown](https://www.linux.com/users/ericstephenbrown)
|
||||
[^#]: url:
|
||||
|
||||
A Closer Look at Voice-Assisted Speakers
|
||||
======
|
||||

|
||||
|
||||
U.S. consumers are expected to drop a bundle this Black Friday on smart speakers and home hubs. A Nov. 15 [Canalys report][1] estimates that shipments of voice-assisted speakers grew 137 percent in Q3 2018 year-to-year and are on the way to 75 million-unit sales in 2018. At the recent [Embedded Linux Conference and Open IoT Summit][2] in Edinburgh, embedded Linux developer and [Raspberry Pi HAT][3] creator Leon Anavi of the Konsulko Group reported on the latest smart speaker trends.
|
||||
|
||||
As Anavi noted in his “Comparison of Voice Assistant SDKs for Embedded Linux Devices” talk, conversing with computers became a staple of science fiction over half a century ago. Voice technology is interesting “because it combines AI, big data, IoT, and application development,” said Anavi.
|
||||
|
||||
In Q3 2017, Amazon and Google owned the industry with 74.7 percent and 24.6 percent, respectively, said Canalys. A year later, the percentages were down to 31.9 and 29.8. China-based Alibaba and Xiaomi almost equally split another 21.8 percent share, followed by 17.4 percent for “others,” which mostly use Amazon Alexis, and increasingly, Google Assistant.
|
||||
|
||||
Despite the success of the mostly Linux-driven smart speaker market, Linux application developers have not jumped into voice app development in the numbers one might expect. In part, this is due to reservations about Google and [Amazon privacy safeguards][4], as well as the proprietary nature of the hardware and cloud software.
|
||||
|
||||
“Privacy is a concern with smart speakers,” said Anavi. “You can’t fully trust a corporation if the product is not open source.”
|
||||
|
||||
Anavi summarized the Google and Amazon SDKs but spent more time on the fully open source Mycroft Mark. Although Anavi clearly prefers Mycroft, he encouraged developers to investigate all the platforms. “There is a huge demand in the market for these devices and a lot of opportunity for IoT integration, from writing new skills to integrating voice assistants in consumer electronics devices,” said Anavi.
|
||||
|
||||
### Alexa/Echo
|
||||
|
||||
Amazon’s Alexa debuted in the Echo smart speaker four years ago. Amazon has since expanded to the Echo branded Dot, Spot, Tap, and Plus speakers, as well as the Echo Show and new [Echo Show 2][5] display hubs.
|
||||
|
||||
The market leading Echo devices run on Amazon’s Linux- and Android-based Fire OS. The original Echo and Dot ran on the Cortex-A8-based TI DM3725 SoC while more recent devices have moved to an Armv8 MediaTek MT8163V SoC with 256MB RAM and 4GB flash.
|
||||
|
||||
Thanks to Amazon’s wise decision to release an Apache 2.0 licensed Alexa Voice Services (AVS) SDK, Alexa also runs on most third-party hubs. The SDK includes an Alexa Skills Kit for creating custom Skills. The cloud platform required to make Alexa devices work is not open source, however, and commercial vendors must sign an agreement and undergo a certification process.
|
||||
|
||||
Alexa runs on a variety of hardware [including the Raspberry Pi][6], as well as smart devices ranging from the Ecobee4 Smart Thermostat to the LG Hub Robot. Microsoft recently began [selling Echo devices][7], and earlier this year partnered with Amazon to integrate Alexa with its own Cortana voice agent in devices. This week, Microsoft announced that users can [voice-activate Skype calls][8] via Alexa on Echo devices.
|
||||
|
||||
### Google Assistant/Home
|
||||
|
||||
The Google Assistant voice agent debuted on the Google Home smart speaker in 2016. It has since expanded to the Echo Dot-like Home Mini, which like the Home runs on a 1.2GHz dual-core Cortex-A7 Marvell Armada 1500 Mini Plus with 512MB RAM and 4GB flash. This year’s [Home Max][9] offered improved speakers and advanced to a 1.5GHz, quad-core Cortex-A53 processor. More recently, Google launched the touchscreen enabled [Google Home Hub][10].
|
||||
|
||||
The Google Home devices run on a version of the Linux-based Google Cast OS. Like Alexa, the Python driven [Google Assistant SDK][11] lets you add the voice agent to third-party devices. However, it’s still in preview stage and lacks an open source license. Developers can create applications with [Google Actions][12].
|
||||
|
||||
Last year, Google [launched][13] a version of its Google Assistant SDK for the Raspberry Pi 3 and began selling an [AIY Voice Kit][14]</a> that runs on the Pi. There’s also a kit that runs on the Orange Pi, said Anavi.
|
||||
|
||||
This year, Google has aggressively [courted hardware partners][15] to produce home hub devices that combine Assistant with Google’s proprietary [Android Things][16]. The devices run on a variety of Arm-based SoCs led by the Qualcomm SD212 Home Hub Platform.
|
||||
|
||||
The SDK expansion has resulted in a variety of third-party devices running Assistant, including the Lenovo Smart Display and the just released [LG XBOOM AI ThinQ WK9][17] touchscreen hubs. Sales of Google Home devices outpaced Echo earlier this year, although Amazon regained the lead in Q3, says Canalys.
|
||||
|
||||
Like Alexa, but unlike Mycroft, Google Assistant offers multilingual support. The latest version supports follow-up questions without having to repeat the activation word, and there’s a voice match feature that can recognize up to six users. A new Google Duplex feature accomplishes real-world tasks through natural phone conversations.
|
||||
|
||||
### Mycroft/Mark
|
||||
|
||||
Anavi’s favorite smart speaker is the Linux-driven, open source (Apache 2.0 and CERN) [Mycroft][18]. The Raspberry Pi based [Mycroft Mark 1][19] speaker was certified by the Open Source Hardware Association (OSHA).
|
||||
|
||||
The [Mycroft Mark II][20] launched on Kickstarter in January and has received $450,000 in funding. This Xilinx [Zynq UltraScale+ MPSoC][21] driven home hub integrates Aaware’s far-field [Sound Capture][22] technology. A [Nov. 15 update post][23] revealed that the Mark II will miss its December ship date.
|
||||
|
||||
Kansas City-based Mycroft has raised $2.5 million from institutional investors and is now seeking funding on [StartEngine][24]. Mycroft sees itself as a software company and is encouraging other companies to build the Mycroft Core platform and Mycroft AI voice agent into products. The company offers an enterprise server license to corporate customers for $1,500 a month, and there’s a free, Raspbian based [Picroft][25] application for the Raspberry Pi. A Picroft hardware kit is under consideration.
|
||||
|
||||
Mycroft promises that user data will never be saved without an opt-in (to improve machine learning algorithms), and that it will never be used for marketing purposes. Like Alexa and Assistant, however, it’s not available offline without a cloud service, a feature that would better ensure privacy. Anavi says the company is working on an offline option.
|
||||
|
||||
The Mycroft AI agent is enabled via a Python based Mycroft Pulse SDK, and a Mycroft Skills Manager is available for Skills development. Like Alexa and Assistant, Mycroft supports custom wake words. The new version uses its homegrown [Precise][26] wake-word listener technology in place of the earlier PocketSphinx. There’s also an optional device and account management stack called Mycroft Home.
|
||||
|
||||
For text-to-speech (TTS), Mycroft defaults to the open source [Mimic][27], which is co-developed with VocaliD. It also supports eSpeak, MaryTTS, Google TTS, and FATTS.
|
||||
|
||||
Mycroft lacks its own speech to-text (STT) engine, which Anavi calls “the biggest challenge for an open source voice assistant.” Instead, it defaults to Google STT and supports [IBM Watson STT][28] and [wit.ai][29].
|
||||
|
||||
Mycroft is collaborating with Mozilla on its open source [DeepSpeech][30] STT, an open source TensorFlow implementation of [Baidu’s DeepSpeech][31] platform. Baidu trails Alibaba and Xiaomi in the [Chinese voice assistant][32] market but is one of the fastest growing voice AI companies. Just as Alibaba uses its homegrown, Alexa-like AliGenie agent on its Tmall Genie speaker, Baidu loads its [speakers][33] with its DeepSpeech-driven [DuerOS][34] voice platform. Xiaomi has used Alexa and Cortana.
|
||||
|
||||
Mycroft is the most mature of several alternative voice AI projects that promise improved privacy safeguards. A recent [VentureBeat][35] article reported on emerging privacy-oriented technologies including [Snips][36] and [SoundHound][37].
|
||||
|
||||
Anavi concluded with some demo videos showing off his soothing, Bulgarian AI whisperer vocal style. “I try to be polite with these things,” said Anavi. “Someday they may rule the world and I want to survive.”
|
||||
|
||||
Anavi’s video presentation can be seen here:
|
||||
<https://www.youtube.com/embed/_dF0cMr3Aag?enablejsapi=1>
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/2018/11/closer-look-voice-assisted-speakers
|
||||
|
||||
作者:[Eric Brown][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://www.linux.com/users/ericstephenbrown
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.canalys.com/newsroom/amazon-reclaims-top-spot-in-smart-speaker-market-in-q3-2018
|
||||
[2]: https://events.linuxfoundation.org/events/elc-openiot-europe-2018/
|
||||
[3]: http://linuxgizmos.com/phat-adds-ir-to-the-raspberry-pi/
|
||||
[4]: https://qz.com/1288743/amazon-alexa-echo-spying-on-users-raises-a-data-privacy-problem/
|
||||
[5]: https://www.techadvisor.co.uk/review/digital-home/amazon-echo-show-2-3685964/
|
||||
[6]: https://www.linux.com/news/event/open-source-summit-na/2017/3/add-skills-your-raspberry-pi-alexa
|
||||
[7]: https://www.theverge.com/2018/11/17/18099978/microsoft-store-amazon-echo-devices
|
||||
[8]: https://www.engadget.com/2018/11/19/alexa-can-now-make-skype-calls/
|
||||
[9]: https://store.google.com/us/product/google_home_max?hl=en-US
|
||||
[10]: https://arstechnica.com/gadgets/2018/10/google-home-hub-under-the-hood-its-nothing-like-other-google-smart-displays/
|
||||
[11]: https://developers.google.com/assistant/sdk/overview
|
||||
[12]: https://developers.google.com/actions/
|
||||
[13]: http://linuxgizmos.com/google-assistant-sdk-dev-preview-brings-voice-agent-to-the-raspberry-pi/
|
||||
[14]: http://linuxgizmos.com/googles-updated-aiy-vision-and-voice-kits-ship-with-raspberry-pi-zero-wh/
|
||||
[15]: http://linuxgizmos.com/android-things-and-google-assistant-appear-in-new-smart-speakers-smart-displays-and-coms/
|
||||
[16]: https://www.linux.com/blog/2018/5/android-things-10-offers-free-ota-updates-restrictions
|
||||
[17]: https://www.engadget.com/2018/11/20/lg-wk9-google-assistant-smart-speaker/
|
||||
[18]: https://mycroft.ai/
|
||||
[19]: http://linuxgizmos.com/open-source-echo-like-gizmo-is-halfway-to-kickstarter-gold/
|
||||
[20]: http://linuxgizmos.com/open-source-voice-assistant-promises-user-privacy/
|
||||
[21]: http://linuxgizmos.com/16nm-zynq-soc-mixes-cortex-a53-fpga-cortex-r5/
|
||||
[22]: https://aaware.com/technology/
|
||||
[23]: https://www.kickstarter.com/projects/aiforeveryone/mycroft-mark-ii-the-open-voice-assistant/posts/2344940
|
||||
[24]: https://www.startengine.com/mycroft-ai
|
||||
[25]: https://mycroft.ai/documentation/picroft/#hardware-prerequisites
|
||||
[26]: https://mycroft.ai/documentation/precise/
|
||||
[27]: https://mycroft.ai/documentation/mimic/
|
||||
[28]: http://linuxgizmos.com/whipping-up-ibm-watson-voice-services-with-openwhisk/
|
||||
[29]: https://wit.ai/
|
||||
[30]: https://github.com/mozilla/DeepSpeech
|
||||
[31]: http://research.baidu.com/Blog/index-view?id=90
|
||||
[32]: https://www.cbinsights.com/research/china-voice-assistants-smart-speakers-ai/
|
||||
[33]: https://www.theverge.com/ces/2018/1/8/16866068/baidu-smart-speakers-dueros-ces-2018
|
||||
[34]: https://dueros.baidu.com/en/index.html
|
||||
[35]: https://venturebeat.com/2018/07/14/alexa-alternatives-have-a-secret-weapon-privacy/
|
||||
[36]: https://snips.ai/
|
||||
[37]: https://soundhound.com/
|
@ -1,4 +1,7 @@
|
||||
30 Best Sources For Linux / *BSD / Unix Documentation On the We
|
||||
ScarboroughCoral translating!
|
||||
|
||||
|
||||
30 Best Sources For Linux / *BSD / Unix Documentation On the Web
|
||||
======
|
||||
|
||||
|
||||
|
@ -1,140 +0,0 @@
|
||||
translating---geekpi
|
||||
|
||||
How To Browse Stack Overflow From Terminal
|
||||
======
|
||||
|
||||

|
||||
A while ago, we have written about [**SoCLI**][1], a python script to search and browse Stack Overflow website from command line. Today, we will discuss about a similar tool named **“how2”**. It is a command line utility to browse Stack Overflow from Terminal. You can query in the plain English as the way you do in [**Google search**][2] and it uses Google and Stackoverflow APIs to search for the given queries. It is free and open source utility written using NodeJS.
|
||||
|
||||
### Browse Stack Overflow From Terminal Using how2
|
||||
|
||||
Since how2 is a NodeJS package, we can install it using Npm package manager. If you haven’t installed Npm and NodeJS already, refer the following guide.
|
||||
|
||||
After installing Npm and NodeJS, run the following command to install how2 utility.
|
||||
```
|
||||
$ npm install -g how2
|
||||
|
||||
```
|
||||
|
||||
Now let us see how to browse Stack Overflow uisng this program. The typical usage to search through Stack Overflow site using “how2” utility is:
|
||||
```
|
||||
$ how2 <search-query>
|
||||
|
||||
```
|
||||
|
||||
For example, I am going to search for how to create tgz archive.
|
||||
```
|
||||
$ how2 create archive tgz
|
||||
|
||||
```
|
||||
|
||||
Oops! I get the following error.
|
||||
```
|
||||
/home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/transport.js:59
|
||||
Transport.prototype.__proto__ = EventEmitter.prototype;
|
||||
^
|
||||
|
||||
TypeError: Cannot read property 'prototype' of undefined
|
||||
at Object.<anonymous> (/home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/transport.js:59:46)
|
||||
at Module._compile (internal/modules/cjs/loader.js:654:30)
|
||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
|
||||
at Module.load (internal/modules/cjs/loader.js:566:32)
|
||||
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
|
||||
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
|
||||
at Module.require (internal/modules/cjs/loader.js:598:17)
|
||||
at require (internal/modules/cjs/helpers.js:11:18)
|
||||
at Object.<anonymous> (/home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/stream.js:8:17)
|
||||
at Module._compile (internal/modules/cjs/loader.js:654:30)
|
||||
|
||||
```
|
||||
|
||||
I may be a bug. I hope it gets fixed in the future versions. However, I find a workaround posted [**here**][3].
|
||||
|
||||
To fix this error temporarily, you need to edit the **transport.js** file using command:
|
||||
```
|
||||
$ vi /home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/transport.js
|
||||
|
||||
```
|
||||
|
||||
The actual path of this file will be displayed in your error output. Replace the above file path with your own. Then find the following line:
|
||||
```
|
||||
var EventEmitter = process.EventEmitter;
|
||||
|
||||
```
|
||||
|
||||
and replace it with following line:
|
||||
```
|
||||
var EventEmitter = require('events');
|
||||
|
||||
```
|
||||
|
||||
Press ESC and type **:wq** to save and quit the file.
|
||||
|
||||
Now search again the query.
|
||||
```
|
||||
$ how2 create archive tgz
|
||||
|
||||
```
|
||||
|
||||
Here is the sample output from my Ubuntu system.
|
||||
|
||||
[![][4]][5]
|
||||
|
||||
If the answer you’re looking for is not displayed in the above output, press **SPACE BAR** key to start the interactive search where you can go through all suggested questions and answers from the Stack Overflow site.
|
||||
|
||||
[![][4]][6]
|
||||
|
||||
Use UP/DOWN arrows to move between the results. Once you got the right answer/question, hit SPACE BAR or ENTER key to open it in the Terminal.
|
||||
|
||||
[![][4]][7]
|
||||
|
||||
To go back and exit, press **ESC**.
|
||||
|
||||
**Search answers for specific language**
|
||||
|
||||
If you don’t specify a language it **defaults to Bash** unix command line and give you immediately the most likely answer as above. You can also narrow the results to a specific language, for example perl, python, c, Java etc.
|
||||
|
||||
For instance, to search for queries related to “Python” language only using **-l** flag as shown below.
|
||||
```
|
||||
$ how2 -l python linked list
|
||||
|
||||
```
|
||||
|
||||
[![][4]][8]
|
||||
|
||||
To get a quick help, type:
|
||||
```
|
||||
$ how2 -h
|
||||
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
The how2 utility is a basic command line program to quickly search for questions and answers from Stack Overflow without leaving your Terminal and it does this job pretty well. However, it is just CLI browser for Stack overflow. For some advanced features such as searching most voted questions, searching queries using multiple tags, colored interface, submitting a new question and viewing questions stats etc., **SoCLI** is good to go.
|
||||
|
||||
And, that’s all for now. Hope this was useful. I will be soon here with another useful guide. Until then, stay tuned with OSTechNix!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-browse-stack-overflow-from-terminal/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/search-browse-stack-overflow-website-commandline/
|
||||
[2]:https://www.ostechnix.com/google-search-navigator-enhance-keyboard-navigation-in-google-search/
|
||||
[3]:https://github.com/santinic/how2/issues/79
|
||||
[4]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[5]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-1.png
|
||||
[6]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-2.png
|
||||
[7]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-3.png
|
||||
[8]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-4.png
|
@ -1,3 +1,5 @@
|
||||
translating----geekpi
|
||||
|
||||
How to Set Different Wallpaper for Each Monitor in Linux
|
||||
======
|
||||
**Brief: If you want to display different wallpapers on multiple monitors on Ubuntu 18.04 or any other Linux distribution with GNOME, MATE or Budgie desktop environment, this nifty tool will help you achieve this.**
|
||||
|
@ -1,3 +1,5 @@
|
||||
HankChow translating
|
||||
|
||||
5 Easy Tips for Linux Web Browser Security
|
||||
======
|
||||

|
||||
|
@ -0,0 +1,127 @@
|
||||
Coupled commands with control operators in Bash
|
||||
======
|
||||
Add logic to the command line with control operators in compound commands.
|
||||
|
||||

|
||||
|
||||
Simple compound commands—such as stringing several commands together in a sequence on the command line—are used often. Such commands are separated by semicolons, which define the end of a command. To create a simple series of shell commands on a single line, simply separate each command using a semicolon, like this:
|
||||
|
||||
```
|
||||
command1 ; command2 ; command3 ; command4 ;
|
||||
```
|
||||
|
||||
You don't need to add a final semicolon because pressing the Enter key implies the end of the final command, but it's fine to add it for consistency.
|
||||
|
||||
**& &** and **||** control operators built into Bash. These two control operators provide some flow control and enable us to alter the code-execution sequence. The semicolon and the **newline** character are also considered to be Bash control operators.
|
||||
|
||||
All the commands will run without a problem—as long as no error occurs. But what happens if an error happens? We can anticipate and allow for errors using theandcontrol operators built into Bash. These two control operators provide some flow control and enable us to alter the code-execution sequence. The semicolon and thecharacter are also considered to be Bash control operators.
|
||||
|
||||
The **& &** operator simply says "if command1 is successful, then run command2." If command1 fails for any reason, command2 won't run. That syntax looks like:
|
||||
|
||||
```
|
||||
command1 && command2
|
||||
```
|
||||
|
||||
This works because every command returns a code to the shell that indicates whether it completed successfully or failed during execution. By convention, a return code (RC) of 0 (zero) indicates success and any positive number indicates some type of failure. Some sysadmin tools just return a 1 to indicate any failure, but many use other positive numerical codes to indicate the type of failure.
|
||||
|
||||
The Bash shell's **$?** variable can be checked very easily by a script, by the next command in a list of commands, or even directly by a sysadmin. Let's look at RCs. We can run a simple command and immediately check the RC, which will always pertain to the last command that ran.
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ ll ; echo "RC = $?"
|
||||
total 284
|
||||
-rw-rw-r-- 1 student student 130 Sep 15 16:21 ascii-program.sh
|
||||
drwxrwxr-x 2 student student 4096 Nov 10 11:09 bin
|
||||
<snip>
|
||||
drwxr-xr-x. 2 student student 4096 Aug 18 10:21 Videos
|
||||
RC = 0
|
||||
[student@studentvm1 ~]$
|
||||
```
|
||||
|
||||
This RC is 0, which means the command completed successfully. Now try the same command on a directory where we don't have permissions.
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ ll /root ; echo "RC = $?"
|
||||
ls: cannot open directory '/root': Permission denied
|
||||
RC = 2
|
||||
[student@studentvm1 ~]$
|
||||
```
|
||||
|
||||
This RC's meaning can be found in the [**ls** command's man page][1].
|
||||
|
||||
Let's try the **& &** control operator as it might be used in a command-line program. We'll start with something simple: Create a new directory and, if that is successful, create a new file in it.
|
||||
|
||||
We need a directory where we can create other directories. First, create a temporary directory in your home directory where you can do some testing.
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ cd ; mkdir testdir
|
||||
```
|
||||
|
||||
Create a new directory in **~/testdir** , which should be empty because you just created it, and then create a new, empty file in that new directory. The following command will do those tasks.
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ mkdir ~/testdir/testdir2 && touch ~/testdir/testdir2/testfile1
|
||||
[student@studentvm1 ~]$ ll ~/testdir/testdir2/
|
||||
total 0
|
||||
-rw-rw-r-- 1 student student 0 Nov 12 14:13 testfile1
|
||||
[student@studentvm1 ~]$
|
||||
```
|
||||
|
||||
We know everything worked as it should because the **testdir** directory is accessible and writable. Change the permissions on **testdir** so it is no longer accessible to the user **student** as follows:
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ chmod 076 testdir ; ll | grep testdir
|
||||
d---rwxrw-. 3 student student 4096 Nov 12 14:13 testdir
|
||||
[student@studentvm1 ~]$
|
||||
```
|
||||
|
||||
Using the **grep** command after the long list ( **ll** ) shows the listing for **testdir**. You can see that the user **student** no longer has access to the **testdir** directory. Now let's run almost the same command as before but change it to create a different directory name inside **testdir**.
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ mkdir ~/testdir/testdir3 && touch ~/testdir/testdir3/testfile1
|
||||
mkdir: cannot create directory ‘/home/student/testdir/testdir3’: Permission denied
|
||||
[student@studentvm1 ~]$
|
||||
```
|
||||
|
||||
Although we received an error message, using the **& &** control operator prevents the **touch** command from running because there was an error in creating **testdir3**. This type of command-line logical flow control can prevent errors from compounding and making a real mess of things. But let's make it a little more complicated.
|
||||
|
||||
The **||** control operator allows us to add another command that executes when the initial program statement returns a code larger than zero.
|
||||
|
||||
```
|
||||
[student@studentvm1 ~]$ mkdir ~/testdir/testdir3 && touch ~/testdir/testdir3/testfile1 || echo "An error occurred while creating the directory."
|
||||
mkdir: cannot create directory ‘/home/student/testdir/testdir3’: Permission denied
|
||||
An error occurred while creating the directory.
|
||||
[student@studentvm1 ~]$
|
||||
```
|
||||
|
||||
Our compound command syntax using flow control takes this general form when we use the **& &** and **||** control operators:
|
||||
|
||||
```
|
||||
preceding commands ; command1 && command2 || command3 ; following commands
|
||||
```
|
||||
|
||||
The compound command using the control operators may be preceded and followed by other commands that can be related to the ones in the flow-control section but which are unaffected by the flow control. All of those commands will execute without regard to anything that takes place inside the flow-control compound command.
|
||||
|
||||
These flow-control operators can make working at the command line more efficient by handling decisions and letting us know when a problem has occurred. I use them directly on the command line as well as in scripts.
|
||||
|
||||
You can clean up as the root user to delete the directory and its contents.
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# rm -rf /home/student/testdir
|
||||
```
|
||||
|
||||
How do you use Bash control operators? Let us know in the comment section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/11/control-operators-bash-shell
|
||||
|
||||
作者:[David Both][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/dboth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: http://man7.org/linux/man-pages/man1/ls.1.html
|
@ -0,0 +1,111 @@
|
||||
How to swap Ctrl and Caps Lock keys in Linux
|
||||
======
|
||||
Linux desktop environments make it easy to set up your keyboard as you want it. Here's how.
|
||||

|
||||
|
||||
For many people who've been computer users for (let's just say) "quite some time now," the Ctrl and Caps Lock keys have been in the wrong place since shortly after the first PC keyboards rolled off the production line. For me, the correct positioning appears in this image of a vintage 1995 Sun Workstation keyboard. (Forgive me for the blurriness of the image; it was taken with a Minox spy camera in low light.)
|
||||
|
||||
If you're interested, you can read about the [history of the Ctrl key location][1]. I'm not going to discuss the various rationales for placing the Ctrl key next to the "a" key versus below the Shift key; I'm not going to comment on the overall uselessness of the Caps Lock key (whoops); and I'm not going to argue with those who advocate using the heel of the hand to activate the Ctrl key, even though it's impossible to do on some laptop keyboards where the keys are inset below the level of the wrist rest (whoops).
|
||||
|
||||
Rather, I'm going to assume I'm not the only one who prefers the Ctrl key next to the "a" and describe how to use the wonderful flexibility that comes with Linux to swap the Ctrl and Caps Lock keys on various desktop environments. Note that this kind of advice seems to have a limited shelf life, as tools for tweaking desktop settings change fairly often. But I hope this offers a good place for you to start.
|
||||
|
||||
### With GNOME 3
|
||||
|
||||
[GNOME 3][2] desktop environment users can use the [Tweaks][3] tool to swap their Caps Lock and Ctrl keys, as you can see below.
|
||||

|
||||
Here's how to do it:
|
||||
|
||||
1. Install the Tweaks tool from your distribution's repositories.
|
||||
2. Start the Tweaks application.
|
||||
3. Select "Keyboard & Mouse" from the left-hand menu.
|
||||
4. Click "Additional Layout Options".
|
||||
5. Click "Ctrl position" on the window that opens and choose "Swap Ctrl and Caps Lock."
|
||||
|
||||
|
||||
|
||||
That's it! By the way, you can do lots of cool stuff with the Tweaks tool. For example, I set my right Ctrl key to be a Compose key, which allows me to type all sorts of characters with keyboard shortcuts—such as ç, é, ô, and ñ and with the keystrokes Compose+c+Comma; Compose+e+Right quote; Compose+o+Circumflex; and Compose+n+Tilde.
|
||||
|
||||
### With KDE
|
||||
|
||||
I don't use [KDE][4], but item 5 in this article about [KDE tweaks that will change your life][5] by my colleague Seth Kenlon will show you how to remap your keys.
|
||||
|
||||
### With Xfce
|
||||
|
||||
As far as I can tell, the [Xfce][6] desktop environment doesn't have a handy tool for managing these kinds of settings. However, the **ctrl:swapcaps** option to the **setxkbmap** command will help you make these changes. This type of modification has two parts:
|
||||
|
||||
1. Figuring out the command's usage;
|
||||
2. Figuring out where to invoke the command so it is activated as the desktop comes up.
|
||||
|
||||
|
||||
|
||||
The first part is pretty straightforward: the command is:
|
||||
|
||||
```
|
||||
/usr/bin/setxkbmap -option "ctrl:nocaps"
|
||||
```
|
||||
|
||||
It's worth executing this in a terminal window to make sure the results are what you expect.
|
||||
|
||||
Assuming it works, where should you invoke the command? That requires some experimentation; one possibility is in the file **.profile** in the user's home directory. Another option is to add the command to the autostart facility in Xfce (look for "Session and Startup" in the Settings Manager).
|
||||
|
||||
Another possibility is to use the same option in the file / **etc/default/keyboard** , which might end up looking like this:
|
||||
|
||||
```
|
||||
# KEYBOARD CONFIGURATION FILE
|
||||
|
||||
# Consult the keyboard(5) manual page.
|
||||
|
||||
XKBMODEL="pc105"
|
||||
XKBLAYOUT="us"
|
||||
XKBVARIANT=""
|
||||
XKBOPTIONS="ctrl:swapcaps"
|
||||
|
||||
BACKSPACE="guess"
|
||||
```
|
||||
|
||||
Note that this kind of change will affect all users, so if you share your computer, be prepared to do some explaining. Also, system updates may overwrite this file, so you'll need to edit it again if your setup stops working. Putting the same information in the file **.keyboard** in the user's home directory might accomplish the same task on the user's behalf.
|
||||
|
||||
Finally, note that these kinds of changes require you to restart Xfce (except when running the command on the command line in the terminal window, but that won't stick past the end of the session).
|
||||
|
||||
### With LXQt and other desktop environments
|
||||
|
||||
I haven't tried [LXQt][7], but if my memory serves from [LXDE][8], I would try the same recipe used above for Xfce. I'd also expect that the Xfce recipe could work for other Linux desktop environments, but, of course, your favorite search engine is always your friend.
|
||||
|
||||
### The console
|
||||
|
||||
I haven't tried this, as I have very few opportunities to interact with the console (what you see on a server or when your window system doesn't come up properly). The recipes presented above affect the terminal window in the way one would hope, i.e., consistently with other applications.
|
||||
|
||||
However, if the file **/etc/default/keyboard** or **~/.keyboard** has already been edited (as described above), the utility **setupcon** is intended to change the console keyboard setup so it functions the same way.** **This [StackExchange article][9], [this other one][10], and [this third one][11] give some ideas on how to effect these changes from both of these files. The third article also talks about using **dumpkeys** and **loadkeys**. It's also worthwhile to read [the setupcon man page][12] — it's short and to the point, and combined with the comments from the StackExchange articles, should be enough to get a solution in place.
|
||||
|
||||
Finally, it's worth emphasizing here the point mentioned in the StackExchange articles - configuring the console IS NOT THE SAME as configuring terminal windows; the latter are configured through the desktop manager as described previously.
|
||||
|
||||
### When all else fails
|
||||
|
||||
The manual pages for **setxkbmap** , **xkeyboard-config** , **keyboard** , **console-setup** , and **setupcon** are all useful references. Or, if you don't like reading manual pages, there's [this great article][13].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/11/how-swap-ctrl-and-caps-lock-your-keyboard
|
||||
|
||||
作者:[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://en.wikipedia.org/wiki/Control_key
|
||||
[2]: https://www.gnome.org/gnome-3/
|
||||
[3]: https://wiki.gnome.org/Apps/Tweaks
|
||||
[4]: https://www.kde.org/
|
||||
[5]: https://opensource.com/article/17/5/7-cool-kde-tweaks-will-improve-your-life
|
||||
[6]: https://www.xfce.org/
|
||||
[7]: https://lxqt.org/
|
||||
[8]: https://lxde.org/
|
||||
[9]: https://askubuntu.com/questions/485454/how-to-remap-keys-on-a-user-level-both-with-and-without-x
|
||||
[10]: https://unix.stackexchange.com/questions/198791/how-do-i-permanently-change-the-console-tty-font-type-so-it-holds-after-reboot
|
||||
[11]: https://superuser.com/questions/290115/how-to-change-console-keymap-in-linux
|
||||
[12]: http://man.he.net/man1/setupcon
|
||||
[13]: http://www.noah.org/wiki/CapsLock_Remap_Howto
|
148
sources/tech/20181122 Getting started with Jenkins X.md
Normal file
148
sources/tech/20181122 Getting started with Jenkins X.md
Normal file
@ -0,0 +1,148 @@
|
||||
[^#]: collector: lujun9972
|
||||
[^#]: translator:
|
||||
[^#]: reviewer:
|
||||
[^#]: publisher:
|
||||
[^#]: subject: Getting started with Jenkins X
|
||||
[^#]: via: https://opensource.com/article/18/11/getting-started-jenkins-x
|
||||
[^#]: author: [Dave Johnson](https://opensource.com/users/snoopdave)
|
||||
[^#]: url:
|
||||
|
||||
Getting started with Jenkins X
|
||||
======
|
||||
Jenkins X provides continuous integration, automated testing, and continuous delivery to Kubernetes.
|
||||

|
||||
|
||||
[Jenkins X][1] is an open source system that offers software developers continuous integration, automated testing, and continuous delivery, known as CI/CD, in Kubernetes. Jenkins X-managed projects get a complete CI/CD process with a Jenkins pipeline that builds and packages project code for deployment to Kubernetes and access to pipelines for promoting projects to staging and production environments.
|
||||
|
||||
Developers are already benefiting from running "classic" open source Jenkins and CloudBees Jenkins on Kubernetes, thanks in part to the Jenkins Kubernetes plugin, which allows you to dynamically spin-up Kubernetes pods to run Jenkins build agents. Jenkins X adds what's missing from Jenkins: comprehensive support for continuous delivery and managing the promotion of projects to preview, staging, and production environments running in Kubernetes.
|
||||
|
||||
This article is a high-level explanation of how Jenkins X works; it assumes you have some knowledge of Kubernetes and classic Jenkins.
|
||||
|
||||
### What you get with Jenkins X
|
||||
|
||||
If you're running on one of the major cloud providers (Amazon Elastic Container Service for Kubernetes, Google Kubernetes Engine, or Microsoft Azure Kubernetes Service), installing and deploying Jenkins X is easy. Download the Jenkins X command-line interface and run the **jx create cluster** command. You'll be prompted for the necessary information and, if you take the defaults, Jenkins X will create a starter-size Kubernetes cluster and install Jenkins X.
|
||||
|
||||
When you deploy Jenkins X, a number of services are put in motion to watch your Git repositories and respond by building, testing, and promoting your applications to staging, production, and other environments you define. Jenkins X also deploys a set of supporting services, including [Jenkins][2], [Docker Registry][3], [Chart Museum][4], and [Monocular][5] to manage [Helm][6] charts, and [Nexus][7], which serves as a Maven and npm repository.
|
||||
|
||||
The Jenkins X deployment also creates two Git repositories, one for your staging environment and one for production. These are in addition to the Git repositories you use to manage your project source code. Jenkins X uses these repositories to manage what is deployed to each environment, and promotions are done via Git pull requests (PRs)—this approach is known as [GitOps][8]. Each repository contains a Helm chart that specifies the applications to be deployed to the corresponding environment. Each repository also has a Jenkins pipeline to handle promotions.
|
||||
|
||||
### Creating a new project with Jenkins X
|
||||
|
||||
To create a new project with Jenkins X, use the **jx create quickstart** command. If you don't specify any options, jx will prompt you to select a project name and a platform—which can be just about anything. SpringBoot, Go, Python, Node, ASP.NET, Rust, Angular, and React are all supported, and the list keeps growing. Once you have chosen your project name and platform, Jenkins X will:
|
||||
|
||||
* Create a new project that includes a "hello-world"-style web project
|
||||
* Add the appropriate type of makefile or build script for the chosen platform
|
||||
* Add a Jenkinsfile to manage promotions to staging and production environments
|
||||
* Add a Dockerfile and Helm charts, created via [Draft][9]
|
||||
* Add a [Skaffold][10] configuration for deploying the application to Kubernetes
|
||||
* Create a Git repository and push the new project code there
|
||||
|
||||
|
||||
|
||||
Next, a webhook from Git will notify Jenkins X that a project changed, and it will run your project's Jenkins pipeline to build and push your Docker image and Helm charts.
|
||||
|
||||
Finally, the pipeline will submit a PR to the staging environment's Git repository with the changes needed to promote the application.
|
||||
|
||||
Once the PR is merged, the staging pipeline will run to apply those changes and do the promotion. A couple of minutes after creating your project, you'll have end-to-end CI/CD, and your project will be running in staging and available for use.
|
||||
|
||||
![Developer commits changes, project deployed to staging][12]
|
||||
|
||||
Developer commits changes, project deployed to the staging environment.
|
||||
|
||||
The figure above illustrates the repositories, registries, and pipelines and how they interact in a Jenkins X promotion to staging. Here are the steps:
|
||||
|
||||
1. The developer commits and pushes the change to the project's Git repository
|
||||
2. Jenkins X is notified and runs the project's Jenkins pipeline in a Docker image that includes the project's language and supporting frameworks
|
||||
3. The project pipeline builds, tests, and pushes the project's Helm chart to Chart Museum and its Docker image to the registry
|
||||
4. The project pipeline creates a PR with changes needed to add the project to the staging environment
|
||||
5. Jenkins X automatically merges the PR to Master
|
||||
6. Jenkins X is notified and runs the staging pipeline
|
||||
7. The staging pipeline runs Helm, which deploys the environment, pulling Helm charts from Chart Museum and Docker images from the Docker registry. Kubernetes creates the project's resources, typically a pod, service, and ingress.
|
||||
|
||||
|
||||
|
||||
### Importing your existing projects into Jenkins X
|
||||
|
||||
**jx import** , Jenkins X adds the things needed for your project to be deployed to Kubernetes and participate in CI/CD. It will add a Jenkins pipeline, Helm charts, and a Skaffold configuration for deploying the application to Kubernetes. Jenkins X will create a Git repository and push the changes there. Next, a webhook from Git will notify Jenkins X that a project changed, and promotion to staging will happen as described above for new projects.
|
||||
|
||||
### Promoting your project to production
|
||||
|
||||
When you import a project via, Jenkins X adds the things needed for your project to be deployed to Kubernetes and participate in CI/CD. It will add a Jenkins pipeline, Helm charts, and a Skaffold configuration for deploying the application to Kubernetes. Jenkins X will create a Git repository and push the changes there. Next, a webhook from Git will notify Jenkins X that a project changed, and promotion to staging will happen as described above for new projects.
|
||||
|
||||
To promote a version of your project to the production environment, use the **jx promote** command. This command will prepare a Git PR that contains the Helm chart changes needed to deploy into the production environment and submit this request to the production environment's Git repository. Once the request is manually approved, Jenkins X will run the production pipeline to deploy your project via Helm.
|
||||
|
||||
![Promoting project to production][14]
|
||||
|
||||
Developer promotes the project to production.
|
||||
|
||||
This figure illustrates the repositories, registries, and pipelines and how they interact in a Jenkins X promotion to production. Here are the steps:
|
||||
|
||||
1. The developer runs the **jx promote** command to promote a project to production
|
||||
2. Jenkins X creates a PR with changes needed to add the project to the production environment
|
||||
3. The developer manually approves the PR, and it is merged to Master
|
||||
4. Jenkins X is notified and runs the production pipeline
|
||||
5. The production pipeline runs Helm, which deploys the environment, pulling Helm charts from Chart Museum and Docker images from the Docker registry. Kubernetes creates the project's resources, typically a pod, service, and ingress.
|
||||
|
||||
|
||||
|
||||
### Other features of Jenkins X
|
||||
|
||||
Other interesting and appealing features of Jenkins X include:
|
||||
|
||||
#### Preview environments
|
||||
|
||||
When you create a PR to add a new feature to your project, you can ask Jenkins X to create a preview environment so you can make your new feature available for preview and testing before the PR is merged.
|
||||
|
||||
#### Extensions
|
||||
|
||||
It is possible to create extensions to Jenkins X. An extension is code that runs at specific times in the CI/CD process. An extension can provide code that runs when the extension is installed, uninstalled, as well as before and after each pipeline.
|
||||
|
||||
#### Serverless Jenkins
|
||||
|
||||
Instead of running the Jenkins web application, which continually consumes CPU and memory resources, you can run Jenkins only when you need it. During the past year, the Jenkins community created a version of Jenkins that can run classic Jenkins pipelines via the command line with the configuration defined by code instead of HTML forms.
|
||||
|
||||
This capability is now available in Jenkins X. When you create a Jenkins X cluster, you can choose to use Serverless Jenkins. If you do, Jenkins X will deploy [Prow][15] to handle webhooks from GitHub and [Knative][16] to run Jenkins pipelines.
|
||||
|
||||
### Jenkins X limitations
|
||||
|
||||
Jenkins X also has some limitations that should be considered:
|
||||
|
||||
* **Jenkins X is currently limited to projects that use Git:** Jenkins X is opinionated about CI/CD and assumes everybody wants to run and deploy software to Kubernetes and everybody is happy to use Git for source code and defining environments. Also, the Serverless Jenkins feature currently works only with GitHub.
|
||||
* **Jenkins X is limited to Kubernetes:** It is true that Jenkins X can run automated builds, testing, and continuous integration for any type of software, but the continuous delivery part targets a Kubernetes namespace managed by Jenkins X.
|
||||
* **Jenkins X requires cluster-admin level Kubernetes access:** Jenkins X needs cluster-admin access so it can define and manage a Kubernetes custom resource definition. Hopefully, this is a temporary limitation, because it could be a show-stopper for some.
|
||||
|
||||
|
||||
|
||||
### Conclusions
|
||||
|
||||
Jenkins X looks to be a good way to implement CI/CD for Kubernetes, and I'm looking forward to putting it to the test in production. Using Jenkins X is also a good way to learn about some useful open source tools for deploying to Kubernetes, including Helm, Draft, Skaffold, Prow, and more. These are things you might want to use even if you decide Jenkins X is not for you. If you're deploying to Kubernetes, take Jenkins X for a spin.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/11/getting-started-jenkins-x
|
||||
|
||||
作者:[Dave Johnson][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/snoopdave
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://jenkins-x.io/
|
||||
[2]: https://jenkins.io/
|
||||
[3]: https://docs.docker.com/registry/
|
||||
[4]: https://github.com/helm/chartmuseum
|
||||
[5]: https://github.com/helm/monocular
|
||||
[6]: https://helm.sh
|
||||
[7]: https://www.sonatype.com/nexus-repository-oss
|
||||
[8]: https://www.weave.works/blog/gitops-operations-by-pull-request
|
||||
[9]: https://draft.sh/
|
||||
[10]: https://github.com/GoogleContainerTools/skaffold
|
||||
[11]: /file/414941
|
||||
[12]: https://opensource.com/sites/default/files/uploads/jenkinsx_fig1.png (Developer commits changes, project deployed to staging)
|
||||
[13]: /file/414946
|
||||
[14]: https://opensource.com/sites/default/files/uploads/jenkinsx_fig2.png (Promoting project to production)
|
||||
[15]: https://github.com/kubernetes/test-infra/tree/master/prow
|
||||
[16]: https://cloud.google.com/knative/
|
@ -1,11 +1,11 @@
|
||||
[^#]: collector: lujun9972
|
||||
[^#]: translator:
|
||||
[^#]: reviewer:
|
||||
[^#]: publishor:
|
||||
[^#]: subject: How to Build a Netboot Server, Part 1
|
||||
[^#]: via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/
|
||||
[^#]: author: [Gregory Bartholomew](https://fedoramagazine.org/author/glb/)
|
||||
[^#]: url:
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: subject: (How to Build a Netboot Server, Part 1)
|
||||
[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/)
|
||||
[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/)
|
||||
[#]: url: ( )
|
||||
|
||||
How to Build a Netboot Server, Part 1
|
||||
======
|
||||
|
@ -0,0 +1,139 @@
|
||||
如何在终端中浏览 Stack Overflow
|
||||
======
|
||||
|
||||

|
||||
前段时间,我们写了一篇关于 [**SoCLI**][1] 的文章,它是一个从命令行搜索和浏览 Stack Overflow 网站的 python 脚本。今天,我们将讨论一个名为 **“how2”** 的类似工具。它是一个命令行程序,可以从终端浏览 Stack Overflow。你可以如你在 [Google 搜索][2]中那样直接用英语查询,然后它会使用 Google 和 Stackoverflow API 来搜索给定的查询。它是使用 NodeJS 编写的免费开源程序。
|
||||
|
||||
### 使用 how2 从终端浏览 Stack Overflow
|
||||
|
||||
由于 how2 是一个 NodeJS 包,我们可以使用 Npm 包管理器安装它。如果你尚未安装 Npm 和 NodeJS,请参考以下指南。
|
||||
|
||||
在安装 Npm 和 NodeJS 后,运行以下命令安装 how2。
|
||||
```
|
||||
$ npm install -g how2
|
||||
|
||||
```
|
||||
|
||||
现在让我们看下如何使用这个程序浏览 Stack Overflow。使用 “how2” 搜索 Stack Overflow 站点的典型用法是:
|
||||
```
|
||||
$ how2 <search-query>
|
||||
|
||||
```
|
||||
|
||||
例如,我将搜索如何创建 tgz 存档。
|
||||
```
|
||||
$ how2 create archive tgz
|
||||
|
||||
```
|
||||
|
||||
哎呀!我收到以下错误。
|
||||
```
|
||||
/home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/transport.js:59
|
||||
Transport.prototype.__proto__ = EventEmitter.prototype;
|
||||
^
|
||||
|
||||
TypeError: Cannot read property 'prototype' of undefined
|
||||
at Object.<anonymous> (/home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/transport.js:59:46)
|
||||
at Module._compile (internal/modules/cjs/loader.js:654:30)
|
||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
|
||||
at Module.load (internal/modules/cjs/loader.js:566:32)
|
||||
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
|
||||
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
|
||||
at Module.require (internal/modules/cjs/loader.js:598:17)
|
||||
at require (internal/modules/cjs/helpers.js:11:18)
|
||||
at Object.<anonymous> (/home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/stream.js:8:17)
|
||||
at Module._compile (internal/modules/cjs/loader.js:654:30)
|
||||
|
||||
```
|
||||
|
||||
我可能遇到了一个 bug。我希望它在未来版本中得到修复。但是,我在[**这里**][3]找到了一个临时方法。
|
||||
|
||||
|
||||
要临时修复此错误,你需要使用以下命令编辑 **transport.js**:
|
||||
```
|
||||
$ vi /home/sk/.nvm/versions/node/v9.11.1/lib/node_modules/how2/node_modules/devnull/transports/transport.js
|
||||
|
||||
```
|
||||
|
||||
此文件的实际路径将显示在错误输出中。用你自己的文件路径替换上述文件路径。然后找到以下行:
|
||||
```
|
||||
var EventEmitter = process.EventEmitter;
|
||||
|
||||
```
|
||||
|
||||
并用以下行替换它:
|
||||
```
|
||||
var EventEmitter = require('events');
|
||||
|
||||
```
|
||||
|
||||
按 ESC 并输入 **:wq** 以保存并退出文件。
|
||||
|
||||
现在再次搜索查询。
|
||||
```
|
||||
$ how2 create archive tgz
|
||||
|
||||
```
|
||||
|
||||
这是我的 Ubuntu 系统的示例输出。
|
||||
|
||||
[![][4]][5]
|
||||
|
||||
如果你要查找的答案未显示在上面的输出中,请按**空格键**键开始交互式搜索,你可以通过它查看 Stack Overflow 站点中的所有建议问题和答案。
|
||||
|
||||
[![][4]][6]
|
||||
|
||||
使用向上/向下箭头在结果之间移动。得到正确的答案/问题后,点击空格键或回车键在终端中打开它。
|
||||
|
||||
[![][4]][7]
|
||||
|
||||
要返回并退出,请按 **ESC**。
|
||||
|
||||
**搜索特定语言的答案**
|
||||
|
||||
如果你没有指定语言,它**默认为 Bash** unix 命令行,并立即为你提供最可能的答案。你还可以将结果缩小到特定语言,例如 perl、python、c、Java 等。
|
||||
|
||||
例如,使用 **-l** 标志仅搜索与 “Python” 语言相关的查询,如下所示。
|
||||
```
|
||||
$ how2 -l python linked list
|
||||
|
||||
```
|
||||
|
||||
[![][4]][8]
|
||||
|
||||
要获得快速帮助,请输入:
|
||||
```
|
||||
$ how2 -h
|
||||
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
how2 是一个基本的命令行程序,它可以快速搜索 Stack Overflow 中的问题和答案,而无需离开终端,并且它可以很好地完成这项工作。但是,它只是 Stack overflow 的 CLI 浏览器。对于一些高级功能,例如搜索投票最多的问题,使用多个标签搜索查询,彩色界面,提交新问题和查看问题统计信息等,**SoCLI** 做得更好。
|
||||
|
||||
就是这些了。希望这篇文章有用。我将很快写一篇新的指南。在此之前,请继续关注 OSTechNix!
|
||||
|
||||
干杯!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-browse-stack-overflow-from-terminal/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/search-browse-stack-overflow-website-commandline/
|
||||
[2]:https://www.ostechnix.com/google-search-navigator-enhance-keyboard-navigation-in-google-search/
|
||||
[3]:https://github.com/santinic/how2/issues/79
|
||||
[4]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[5]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-1.png
|
||||
[6]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-2.png
|
||||
[7]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-3.png
|
||||
[8]:http://www.ostechnix.com/wp-content/uploads/2018/04/stack-overflow-4.png
|
Loading…
Reference in New Issue
Block a user